Code Snippet
Cross-Browser Min Height
div {
min-height: 500px;
height:auto !important;
height: 500px;
}
This works because (thankfully?) IE treats "height" how "min-height" is supposed to be treated.
Source: Dustin Diaz
Alternate Using Expressions (IE Only)
div {
height: expression( this.scrollHeight < 501 ? "500px" : "auto" );
}
Sets the minimum height in IE to be 500px. Make sure that this.scrollHeight < 501 is 1 px greater than the minimum height that you want or you will get some strange results.
Does this only apply to IE6? Doesn’t IE7 support min/max height/width?
Does this apply to % values as well?
I hate to be obvious but:
div {
min-height: 500px;
_height: 500px;
}
Easier to read and works does it not?
Underscore hacks will make your css invalid, and using ie expression can impact performance so that’s why the first snippet is so cool :)
DigWP
A book and blog co-authored by Jeff Starr and myself about the World's most popular publishing platform.
Quotes on Design
Design, like Art, can be an elusive word to define and an awfully fun thing to have opinions about.
HTML-Ipsum
One-click copy to clipboard access to Lorem Ipsum text that comes wrapped in a variety of HTML.
Bookshelf
Hey Chris, what books do you recommend? These, young fertile mind, these.