When overflow: hidden Doesn’t Hide in IE
I’ve come across this problem before, where I want to hide the overflow of an element, this works fine in all browsers except IE - however it’s never been a problem in anything that I’ve progressed far enough with to worry about fixing it for IE.
Well this evening I came across the problem again, and found the solution - IE (I’m just looking at 6 here - not sure if 7 does the same) doesn’t like it when you have a position: relative; on the child (or possibly children) of an element which you have declared overflow: hidden;.
So in my case swapping that out for position: absolute; on the child and overflow: hidden; position: relative; on the parent worked a charm. Now IE 6 plays nicely like its other browser friends.
Comments
There have been 30 comments so far, join the discussion.
Pages: [2] 1 » Show All
30. VT - 2nd Nov 2009 - 1:49 pm
wow! That helped a lot! Thank you very much indeed!
29. fabio - 8th Jul 2009 - 8:48 pm
man..you are a genius xD
thanks a lot
28. Anton - 19th Mar 2009 - 12:45 am
Thanks a lot
27. Regine - 16th Mar 2009 - 9:45 am
Thanks a lot, you saved my day.
26. KarlanKas - 11th Mar 2009 - 7:26 am
Thank you very very very much!! At last!!
25. Seb - 8th Mar 2009 - 9:02 pm
Thx Joe, works perfectly for ie6 + Ie7 ;)
24. Six Studios - overflow: hidden + position: relative doesn’t work in IE 6/7 - 8th Jan 2009 - 5:04 am
[…] http://www.defusion.org.uk/archives/2007/04/02/when-overflow-hidden-doesnt-hide-in-IE/ […]
23. Joe - 13th Nov 2008 - 8:09 pm
Even better: leave the children elements alone, and just stick with position:relative; on the parent.
22. Usman - 4th Sep 2008 - 4:29 pm
Been searchin Google for a fix, and finally found it. Thanks much.
21. Pavel - 3rd Jul 2008 - 1:06 pm
I know i won’t be first and last neither who say that, but it really works. Thanks a lot
Leave a comment
No HTML please, only textile. For code please use [lang]...[/lang] tags (e.g. [html]...[/html] for HTML)