Why Wait Webs

blog

Internet Explorer 6 Disappearing Content Bug

Sunday, January 11th, 2009
Filed under: Designers — Tags: , , — Jt Hollister

I don’t like Internet Explorer. I don’t think I’ve made that any secret. One of the reasons for that is that there are many instances where fully valid code won’t render properly in IE6 — many more instances than is the case with other browsers.

IE6 Showing its True Malevolent Self

IE6 Showing its True Malevolent Self

Today I found the strangest and most terrible bug I’ve ever encountered. In Internet Explorer 6, my main content was completely invisible. Images and text alike were simply gone! The container DIV was stretched out as it would be if the content were there, and the text was selectable! If I highlighted the text, in fact, I was able to see it, even after de-selecting it. On a page refresh however, my content would simply disappear again, only to reappear when highlighted.

I consider this the most terrible bug ever because in most cases, a bug will rearrange your website, or make it look ugly, but users will still be able to access the content. The content is the reason for the site’s existence, and with this disappearing content bug, users of Internet Explorer 6 will not see your content unless they think to highlight it (and in that particular demographic, I’m willing to bet the odds of that are pretty low). Thus your entire site is rendered unusable and pointless. So read on for the fix!

It took only a small amount of research to get to the bottom of it — for what else could one call this bug, besides the IE6 Disappearing Content Bug? It is exactly as you might have guessed, a simply programming oversight, a glitch in the matrix, if you will. From my research no one has ever fully determined the cause, but essentially the use of floats in certain instances will cause your content to hide itself.

The Fix

It was simple enough to fix the bug, and ensure that my content was not hidden, did not disappear, and rendered properly in all circumstances (that I was able to test, anyway). First I applied position:relative; to the DIV that contained my content. Note that the DIV itself was not floated, though there were some floated divs inside of it. Which brings me to the next step, for now that my text was showing up, the floated elements below it which had previously appeared just fine were now hidden. So I tried the same thing again, applying position:relative; to the floated DIVs themselves. Worked like a charm!

In my instance, things all worked out okay like this, and if it’s possible, your disappearing content problems should be solved by applying position:relative; to all affected DIVs or other elements (as far as I know, DIVs are most common). But what if the DIV or element with hidden content is required to be positioned differently than relative? Well, I found a page that described a few other workarounds, although I haven’t tested them myself. Here they are:

The first of these includes wrapping paragraph tags around your floated elements. Yet again, this can cause problems sometimes. Putting an extra paragraph tag is also unfortunate, as it adds an unnecessary and unmeaningful element to the page, which is always a bad thing if semantics are important to you (and they should be, but that’s a topic for another day).

The final workaround I found involves removing the background property from upper-level DIVs. In most cases, however, this won’t work. In my case I had both background-image and background-color set, and both were needed. That said however, if none of the other workarounds would have worked for me, I would have experimented with wrapping an extra DIV around the content — one with no background. I have no idea if this will work or not, but regardless, it’s another unnecessary element on your page and comes dangerously close to Divitus. But if it’s the only way to get the job done and force your content to reappear and stay, it may just be a necessary element after all.

If none of these workarounds work for you, then unfortunately, as is frequently the case with IE6, you may have to rethink your layout a bit in order to get around this. Aside from that, all we can do is hope and pray that the remaining 20% or so of people will either upgrade to IE7, or ideally anything else.

If you happen to know of another workaround, or have anything else to say about this, fire away in the comments!

Share this article:

  • Digg
  • TwitThis
  • Facebook
  • del.icio.us
  • StumbleUpon
  • Google

related posts

8 Responses to “Internet Explorer 6 Disappearing Content Bug”

  1. tobik says:

    This quite well-known bug but I always forget the solution:) So thank you.

    The worst thing about IE is that there are actually three versions of IE (6, 7, 8) and each of them is different and has different bugs. Therefore optimalization of web for IE means in fact optimalization for three totaly different browsers. I love Firefox because of its automatical updates. On my web 99% visitors have >3 version of Firefox. And IE? 50% 8, 35% 7 and 15% 6. And 15% is still quite a lot. I can’t ignore them.

    But as the web, I am currently working on, is for my school and I am not paid for it, I can afford a little bit non-professional approach :) I am going to put big red box to the middle of page. This box will contain some kind of warning (and maybe the F* word, haven’t decided yet) and of course only IE6-users will see it.

  2. Jt Hollister says:

    Thanks for your response. Indeed, IE and its many versions are the bane of web designers the world over. And with every new release, instead of simply adopting the standards that everyone else has been using and that worked perfectly well for the last decade, they decide to go off and create their own new “standard”. FAIL.

  3. Webworker says:

    Thx for this easy way to fix this bug!!!

  4. Irina says:

    Man, I hate that IE! It takes away sometimes hours of my life to simply find a workaround its numerous bugs.
    Not to mention that I have to create a separate style sheet for this dumb browser each time.
    Thanks for posting this advise.

  5. Michael says:

    I’m so glad I found this. The first time I ran into this bug, I just assumed that I was unlucky… The website I was editing used a pre-built header and navigation column, so I figured that one of the “clear” or “float” properties I had added wasn’t working well with the template. But today, I ran into this bug again on a brand new website that I just built from scratch (using the most easy-to-read, standards-compliant code I’ve ever written). Running into the bug twice in 2 weeks made me assume that others had also struggled with, and hopefully conquered, this bug. I’m glad you did, thanks for the solution!

    What’s worse is that this issue seems to be fixed in IE6 Service Pack 3, which is the only version of IE6 for which Microsoft provides a virtual machine test-environment. …makes it very difficult to track down this bug when your client says, “Nothing’s showing up on my screen!”

  6. Jt Hollister says:

    Ineed, one of the most annoying bugs I’ve ever had to work with. Glad you found the site and are finding use from the fix.

  7. Jishua says:

    Very helpful, thanks. In my case it was actually the use of relative positioning that would cause content to disappear. (My content wasn’t clickable with static positioning as a result of a pngfix). The solution is what eventually worked for me. Used divs though.

  8. Jishua says:

    ^Stripped out my html. My comment above should read: The “p” tag solution is what eventually worked for me. Used divs though.

Leave a Reply