[CSS] Fixing overflow: hidden in IE6 and IE7
Samstag, 14. Januar 2012 - 08:00 Uhr
I just again ran into a problem with old IEs’ handling of overflow: hidden and found a pretty simple fix for it in the comments on this article. For the sake of simplicity, I’ll just post the solution here, which made overflow: hidden work correctly in IE6 and IE7 (actually tested it in IE7 mode of IE9, where it had the desired effect).
Assume we want to have the DIV mydiv to be only 300px high, although it contains a larger IMG element.
HTML:
<div class="mydiv">
<img src="/images/my-large-image.jpg" alt="Large image" width="960" height="360" />
</div>
CSS:
.mydiv {
overflow: hidden;
height: 300px;
position: relative; /* IE 6 and IE7 fix for overflow: hidden */
}
Hope this solution for IE overflow: hidden works for you as well. And lets hope that old IE browsers die soon enough…
loading...
Ähnliche Beiträge
- [PHP] array_flatten() 7. Dezember 2007
- [PHP] Umlaut-Domain Darstellung von Punycode in “normale” Umlaute konvertieren 28. November 2011
- Google Bildersuche mit Farbvorgabe 25. März 2009
- Lyrics in verschiedenen Varianten – The Killers: Spaceman 1. Dezember 2008
- Maggi: Ravioli in pikanter Sauce – Mit Fleisch in der Sauce (!!) im Test 23. Juni 2007

Hey, hier bloggt Jan Papenbrock. Er studiert Wirtschaftsinformatik an der Uni Münster. Nebenbei erstellt er Webseiten und interessiert sich für SEO.
Manchmal habe ich das gefühl, man kann im IE fast alles mit Position relative lösen – . -