Demo
Due to the nature of the bug, the demo is available on a separate page
- HTML Code:
<div><a href="#">Hover Me</a></div>
- CSS Code:
div {
background-color: #000;
}
a {
width: 100%;
display: block;
border: 1px solid #000;
color: #ddd;
}
a:hover {
background-color: #fff;
color: #000;
}
In IE7 the background on the link will not change to white on hover. This bug is so fragile that I may as well write a tutorial on how to produce it instead of how to fix it! Check it out: the non-hover state needs "layout", background-color
(and not background
can be used nor background-image
can be used) on the :hover
selector. The non-hover state needs to have no background set, border
needs to be set and, *drum roll*, the bug only shows itself when the background-color
on the :hover
is set to pure white (i.e. #fff
, #fffff
or white
). Pretty insane, huh? :)