Absolutely positioned divs randomly disappear
8 May, 2008
We came across a problem today that had us completely stumped. With a certain site on IE7 an absolutely positioned div would randomly disappear. In IE6 the story was far worse with the div not showing up at all.
In the end we tracked it down to a bug in IE where an absolutely positioned item next to a floated item would cause the absolute item to disappear! The solution? Add in an empty div before and after the absolutely positioned one.
So it looks like this:
<div style=”float:left”>The floated Div!</div>
<div class=”emptyDivToFixAbsoluteVanishingBug”></div>
<div style=”position:absolute; top:0; right:0;height:12px; width:40px; background-color:#00ff00;”>Here’s the absolute Div!</div>
<div class=”emptyDivToFixAbsoluteVanishingBug”></div>
This really helped me, thanks!
Brilliant, helped loads. So simple.
Try this one http://www.search-this.com/2008/04/09/css-an-absolute-mess/
Bizarre… thanks so much for the tip.
[...] Then it would come wandering back the next time. Luckily, thanks to Google, I found the answer on Make it Mobile. Turns out that an absolutely positioned element next to a floated element will randomly not show [...]