Problem: IE 6 and IE 7 does not support min-width, min-height, max-width, max-height css properties. CSS code with these properties work very well in other browsers.
Solution: IE provides Dynamic Properties to solve this problem. IE provides “expression“ propert/function which is evaluated at runtime and the value is assigned to the CSS property.
For example: Lets look at the below css
position:absolute; left:expression(document.body.clientWidth/2-oDiv.offsetWidth/2);
In this example left property will be assigned the value of ” document.body.clientWidth/2-oDiv.offsetWidth/2 “.
So now to set min-height of a div with id ‘xyz’ in CSS we write:
For Internet Explorer
HTML
<div id=”xyz” class=”xyz”/>
CSS
.xyz{ height:expression(document.getElementById('xyz').scrollHeight > 50 ? "50px" : document.getElementById('xyz').scrollHeight+"px"); }
For other Browsers
.xyz{ min-height:50px; }
The same holds true for all other properties namely max-height,max-width,min-width.
For more information about expression you can read this article.



























































