Fixing problem in IE7 where DIV box doesn’t expand with it’s content



Well, this is my first post on the blog, but it’s nothing too interesting, just something I came across today.

I found an old website which had previously been working fine in IE6 and the previous version of Firefox, but when viewed in IE7 something broke.

Basically, the CSS I had previously set a height of 50px. In IE6, when the contents of that DIV went further than 50px, the DIV would expand to fit it. But in IE7 this was not the case, so the DIV stayed at 50px, but the contents spilled out over it.

Although it took me a while to find out what the problem was, it turned out to be a very easy fix. Just replace height: 50px with min-height: 50px. Et Voila! That did the job nicely.

You can find more info on why this changed in IE7 from the MSDN site.

Hope someone finds that useful.

Cheers.
Chris

Tags: ,   Posted in CSS

Some other posts you might be interested in...

Leave a Reply