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
    Interview with a Pornhub Web Developer

    Regardless of your stance on pornography, it would be impossible to deny the massive impact the adult website industry has had on pushing the web forward. From pushing the browser's video limits to pushing ads through WebSocket so ad blockers don't detect them, you have...

  • By
    Introducing MooTools Templated

    One major problem with creating UI components with the MooTools JavaScript framework is that there isn't a great way of allowing customization of template and ease of node creation. As of today, there are two ways of creating: new Element Madness The first way to create UI-driven...

Incredible Demos

  • By
    HTML5 Context Menus

    One of the hidden gems within the HTML5 spec is context menus. The HTML5 context menu spec allows developers to create custom context menus for given blocks within simple menu and menuitem elements. The menu information lives right within the page so...

  • By
    Multiple Backgrounds with CSS

    Anyone that's been in the web development industry for 5+ years knows that there are certain features that we should have had several years ago. One of those features is the HTML5 placeholder; we used JavaScript shims for a decade before placeholder came...

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!