overflow: hidden + position: relative doesn't work in IE 6/7
January 7th, 2009
Problem
I hit an IE 6/7 bug today. My HTML was as follows:1 2 3 4 5 6 7 8 |
<div id="container"> <ul> <li>Link</li> <li>Link</li> <li>Link</li> ... </ul> </div> |
My CSS was as follows:
1 2 3 4 5 6 7 8 |
div#container { overflow: hidden; height: 400px; } div#container ul { position: relative; } |
The list content would display and flow outside of the container.
Solution
Setting the UL to position: relative causes the bug in Internet Explorer 6 and 7.Moments after finding the source of the problem I was pointed to this article by a friend:
http://www.defusion.org.uk/archives/2007/04/02/when-overflow-hidden-doesnt-hide-in-ie/
In the article the writer isn’t aware if the bug exists in Internet Explorer 7. Yes it does.
Leave a Reply