Friday, April 1, 2011

min-height in IE

All the standard browsers have the min-height CSS property, but IE has it only in the strict !DOCTYPE mode (which is a nightmare) and it does not work properly anyway.
As a workaround, we can do the following
1) Specify the min-height which is ignored by IE
2) Specify the "hight" for IE only.
How to make the other browsers to ignore the "height"?
There are at least two solutions found:
1) Make a weird selector path, like:
* html .dd_h { height: 18px; }
(.dd_h is the class name for the object which need the min-height)
2) Add the style property with an underscore ahead:
.dd_h { min-height: 18px; _height: 18px; }
In some reason IE processes such property as usual, and of course it's ignored by proper browsers.

Source:
http://www.cssplay.co.uk/boxes/minheight.html
http://sandgroper14.wordpress.com/2007/05/24/css-min-height-issue-solved/

No comments:

Post a Comment