When hovering over links that have a background image applied, the image flickers in Internet Explorer.
A Javascript-based solution is available, and a workaround involving a second background image applied to the list item element containing the anchor tag.
When hovering over links that have background images applied, they often 'flicker' in Internet Explorer. Many solutions have been proposed, but only two seem to be adopted widely.
<script type="text/javascript">
try {
document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}
</script>This method appears to be a reasonably solid way to kill the problem, but requires Javascript be enabled in the client browser, of course.
Text ID: BACKGROUND_IMAGE_FLICKERS_ON_HOVER
To add a comment, please Log in.
Simple Solution
by jthome06 on August 3, 2009
There is a simple solution to this. Put a background image ("on" image) in the list item, and a background image ("off" image) in the anchor tag (setting the display to "block"). On the "hover" pseudo class for the anchor tag, set the background-image to "none", allowing the "on" state to show. Works great on IE6 (with no flicker effects) as well as all modern browsers.
Use sprite images
by jsnilsson on August 30, 2007
You can also, if fx. in a menu use a 'sprite' image. That is an image with both on and off state placed one over the other. Then you use this css:
a
{ display:block; width:226px ; height:51px; background:url(images/fp_quicklinks_1.png) no-repeat top left; }
a:hover
{ background-position:0 -51px; }
Where -51px is the amount of pixels down that the rollover image is
You can also use CSS
by achtungbaby on February 4, 2007
html {
filter: expression(document.execCommand("BackgroundImageCache", false, true));
}
Seems to be *the* solution.
by Thierry Koblentz on December 18, 2006
... far better than telling users to change their settings ;-)
Noting the default IE cache setting and that this issue is fixed in IE7
by ALsp on December 16, 2006
The default cache setting for IE6, which is the only browser version affected by this bug, is "Check for newer versions of stored pages: Automatically". The flicker bug mostly affects web developers who tend to purposely change the default cache setting for testing dynamic pages. Also note that the cache bug has been fixed in IE7.
IE settings
by Rifton on December 15, 2006
This is usually caused by your Internet Options > "Temporary Internet Files"
settings in IE. If you have "Check for newer version of stored pages:" set as
"Every visit to the page" background flickering will happen. Set it to the next
one down "Every time you start Internet Explorer" and the flicker should stop.
flicking
by erkanoe on December 15, 2006
The IE6/Microsoft chicane should end soon. Firefox at about 40% i some European countries, continue! As mentioned there's downside of JS which is it can be disabled. But people that know why and how to do it don't usually use IE, or do they? :) Anyway, thanks for the tip.