Preventing The IE6 CSS Background Flicker

By  on  

One of the nagging issues that Internet Explorer creates is a flicker on anchor tag background images. Did you know, however, that there is a quick and easy way to prevent that problem using a little bit of JavaScript? Simply place the following JavaScript code in the header section of your website, refresh the page, and bid adieu to another IE6 issue.

Recent Features

  • By
    Vibration API

    Many of the new APIs provided to us by browser vendors are more targeted toward the mobile user than the desktop user.  One of those simple APIs the Vibration API.  The Vibration API allows developers to direct the device, using JavaScript, to vibrate in...

  • By
    Chris Coyier’s Favorite CodePen Demos

    David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you...

Incredible Demos

  • By
    Fixing sIFR Printing with CSS and MooTools

    While I'm not a huge sIFR advocate I can understand its allure. A customer recently asked us to implement sIFR on their website but I ran into a problem: the sIFR headings wouldn't print because they were Flash objects. Here's how to fix...

  • By
    Adding Events to Adding Events in MooTools

    Note: This post has been updated. One of my huge web peeves is when an element has click events attached to it but the element doesn't sport the "pointer" cursor. I mean how the hell is the user supposed to know they can/should click on...

Discussion

  1. Steve

    You can do the same thing by using .htaccess to cache the file. I don’t know if there is a minimum cache offset but a day works. And if you are following the yslow guidelines you get this as an added benefit. The flicker is actually caused by IE revalidating the image. The advantage to this method beyond speeding up your site is it doesn’t require JavaScript to work.

  2. Awesome man! Thanks for sharing this.

  3. Thanks, this worked great! A simple solution to an annoying behavior.

  4. P

    Hi,

    Where can I get the Javascript code to resolve the issue?

    regards,

    N

  5. valentina

    great! and thank you!

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!