I'm using the CSS based rollover "trick" that switches the background position of the element's background image on hover.
The CSS
#welcome #step1
{background: transparent url(../img/mock/homepage_welcome_step1.png) no-repeat scroll left top;}
#welcome #step1:hover
{background: transparent url(../img/mock/homepage_welcome_step1.png) no-repeat scroll right top;}
The HTML
<div id="welcome">
<a class="steps" id="step1" href="?page=signup"></a>
...
</div>
Naturally IE6 messes this simple thing up. All my rollovers blink.
Upon mouse over the image vanishes for a moment then moves to the over state. An interesting quirk, if I navigate away from the page then press the BACK button the problem seems to go away!
I'm thinking it has to do with the PNG image files (though they don't have any transparency) Or perhaps something simple as doc type (XHTML transitional)
Thanks for your insight.
EDIT (SOLVED):
Jitendra provided the link to solve the problem. I simply added this to the head:
<!--[if IE 6]>
<style type="text/css" >
html {
filter: expression(document.execCommand("BackgroundImageCache", false, true));
}
</style>
<![endif]-->
See these solutions-
http://ajaxian.com/archives/no-more-ie6-background-flicker
http://www.hedgerwow.com/360/bugs/dom-fix-ie6-background-image-flicker.html
The browser is requesting the image from the server for each CSS rule where you specify the url()
property. To fix this, simply combine the background
portion of your two rules into one rule and set the background-position
property for each state of the css sprite.
#step1, #step1:hover {
background: transparent url(../img/mock/homepage_welcome_step1.png) no-repeat scroll;
}
#step1 {
background-position: left top;
}
#step1:hover {
background-position: right top;
}
This problem actually happens in many browsers. It's just more noticeable in IE6.
As a side note, if you're using IDs, specifying two ids in your selector is unnecessary. IDs should be unique to the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With