Friday, March 19, 2010

Cross-Browser Min Height

div { min-height: 500px; height:auto !important; height: 500px; }

This works because  IE treats “height” how “min-height” is supposed to be treated.

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.

Ref: CSSTricks

No comments:

Post a Comment