IE Problem: a transparent div above a drawing does not call CSS: hover

Here is the problem: I want to create reactive zones on the image using a transparent div, but the following code does not work on IE (tested on Chrome): the background color of the div "hover_zone" is not a change at all.

The problem is that the background color is set to transparent. Use any valid color, for example #FFF, and it works (it seems IE thinks: transparent, it does not contain anything, does not display it).

<html>
<body>

<style type='text/css'>

#hover_zone{
    background-color:transparent;
    visibility: visible;
    position:absolute;
    width:40px;
    height:40px;
    left:10px;
    top:10px;
    z-index:1000;
}

a:hover #hover_zone{
    background-color:#0C0;
    visibility: visible;
}

</style> 

<div id="container">
  <img src="http://ptaff.ca/blogue/wp-content/uploads/noir_black.png" />
  <a href="#"><div id="hover_zone"></div></a>
</div>

</body>
</html>

Thank you for your help!

Hooray!

+3
source share
4 answers

I had this exact problem and fixed it using this style:

div#hover-zone { background:transparent url('../images/spacer.gif') 0 0 repeat; }

where spacer.gif - transparent gif 1px.

hope this helps.

+7

, ..

   background-color: #ffffff;  /* the background          */
   filter:alpha(opacity=50);   /* Internet Explorer       */
   -moz-opacity:0.5;           /* Mozilla 1.6 and below   */
   opacity: 0.5;               /* newer browser and CSS-3 */
+2

, , "" , . , "" , , , , - , . , , , , , .

.hotspot
{
    background-color: #FFFFFF; /* will be visible upon hover */

    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE 8 */
    filter: alpha(opacity=0); /* IE 5-7 */
    -moz-opacity: 0; /* Netscape */
    -khtml-opacity: 0; /* Safari 1.x */

    opacity: 0;
}
.hotspot:hover
{
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; /* IE 8 */
    filter: alpha(opacity=70); /* IE 5-7 */
    -moz-opacity: 0.7; /* Netscape */
    -khtml-opacity: 0.7; /* Safari 1.x */

    opacity: 0.7;
}
+1

'img' 'a' 'span' 'div' ( )

<style type='text/css'>

#hover_zone{
    position:absolute;
    display:block;
    width:40px;
    height:40px;
    left:10px;
    top:10px;
}
a:hover #hover_zone{
    background-color:#0C0;
}

</style> 

<div id="container">

  <a href="#"><span id="hover_zone"></span><img src="http://revaxarts.com/portfoliodata/fotobox/screenshot.jpg" /></a>
</div>
0

Source: https://habr.com/ru/post/1766045/


All Articles