Here is the problem : I want to create reactive zones on a image using transparent div, but the following code doesn't work on IE (tested on Chrome) : the background-color of the div "hover_zone" doesn't change at all.
The problem is due to the background-color set to transparent. Use any valid color like #FFF and it works (it seems IE thinks like: it's transparent, it doesn't contain anything, let's 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>
Thanks for your help!
Cheers!
user filter for ie
I had this exact problem and fixed it with this style:
where spacer.gif is a 1px transparent gif.
hope this helps.
Put the 'img' inside the 'a' and use 'span' for the 'div' (blockelement not allowed in inline)
I had this same problem, and my solution was to make the element have a "real" background color, but have zero opacity. Unfortunately, there is no "good" crossbrowser way to make that happen, but since I happened to need the element be partially transparent on hover, that was a de facto non-issue, so this solution worked well for me. It may not be right for you, but perhaps it will help others so I'll post it anyway.