SOLVIUM

Webentwicklung

[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…

GD Star Rating
loading...
[CSS] Fixing overflow: hidden in IE6 and IE7, 4.5 out of 5 based on 2 ratings

, , , , | Kommentar schreiben | Trackback einrichten

Eine Reaktion zu “[CSS] Fixing overflow: hidden in IE6 and IE7”

» Einen Kommentar schreiben

  1. Markus

    Manchmal habe ich das gefühl, man kann im IE fast alles mit Position relative lösen – . -

Einen Kommentar schreiben

Blog Blogs Code DJK Dyckburg Einkaufen EM 2008 Essen Film Firefox Fotos Fussball Games Geburtstag Gewinnspiel Google Gutenachtgeschichten Handy ich Katzen Kreta Lebensweisheiten Musik Münster Münster Poker Politik Programmierung real Rechner Schokolade SEO Shop Studium The Killers Trash TV Twitter unblogbar Uni Video Web Weihnachten Werbung Wirtschaft Wordpress

© 2006-2012 Solvium.de - von und mit Jan Papenbrock - Impressum - Kontakt aufnehmen

» Blog powered by Wordpress. Silk icons von FamFamFam.