Click to See Complete Forum and Search --> : min-height hack...questions


irf2k
08-12-2008, 10:56 PM
I searched for a min-height hack on google, and found some complicated stuff that I didn't understand, but I learned about "!important" and I came up with this:

min-height:420px;
height:auto !important;
height:420px;

i have FF and IE7 and this works fine, since IE7 supports min-height, as does FF.

Assumption 1. I'm told that browsers that DON'T support min-height will also ignore the "!important" line, and instead set the height to 420px.

Assumption 2. I'm also told that browsers that ignore the min-height attribute, treat height in the same way (i.e. they will expand as the content expands, but will be at least that height).

So, are my assumptions correct? Will this work on any browser, or are there browsers that ignore min-height but treat height correctly?

TIA

Centauri
08-13-2008, 02:03 AM
The only browser in common use that doesn't support min-height is IE6. The above hack works as IE6 doesn't recognise the important rule when it is over-ridden in the same style block, and it happens to treat height like min-height anyway.

I much rather either use a separate conditional-comment-linked stylesheet for IE6, or the "star-html" hack as they are less confusing and easier to remove when support for IE6 is eventually considered dead.