IE Peek-a-boo Bug

Diagnosis

Affected browsers:
Internet Explorer 6 on Windows.
Visual appearance:
disappearing or partial content that usually reappears after scrolling or window resize.
Triggers:
It seems that the bug is caused when the clearer div is physically touching the floating div. No layout on containers.

Overview

Imagine you have created a div that includes a floating element along with some content. Below the floated div is another div that is used to clear the float. In any modern browser everything works fine. However, when you test the page in IE 6, none of the content next to the floated element is visible. If you minimize and then restore the browser or sroll up and down the content suddenly appears. No wonder why it is called a Peekaboo Bug. The demo above demonstrates this bug, try viewing this page in IE 6. This bug has a little brother disappearing content bug read the solution for that bug since it is a bit cleaner and might be sufficient in your case.

Demo

Thanks to Position is Everything for proving the bug demo.


 Float 

 test link 
This is bare text. Test link
This is text inside a div. Test link
This is bare text. Test link
This is text inside a div. Test link
This is bare text. Test link
This is text inside a div. Test link
This is bare text. Test link
Clearing div
This div is after the cleared div. (purple box) If cleared div does not touch float, bug is not triggered. Test link

You may want to look at this demo on an empty page to see the full scaled effect

Solution

This is a hasLayout bug, and is fixed by setting hasLayout to true on the float container (div#floatholder in this demo)

Suggested reading

That is all! Happy fixing =)

Comments