min-height

As has been documented elsewhere, you can use expressions to mimic some nice CSS features that Mozilla already supports.

My quick min-height workaround:

height: expression('32px'); min-height: 32px;
Since IE's height property behaves like min-height, I just set it using expression so that IE is the only browser to recognize the property. All other browsers should see min-height and use accordingly.
Published April 26, 2004 · Updated September 17, 2005
Categorized as HTML and CSS
Short URL: https://snook.ca/s/157

Conversation

8 Comments · RSS feed
Ben said on March 09, 2005

This workaround is the simplest most effective way to achieve the min-height affect accross NS, IE, & Mozzi.

THANKS a million!!!

Jay661 said on August 06, 2005

Hey there,

I love the solution to the min-height ie problem. Just got a question about it, i want to make min-height:100%; using the height: expression('32px'); solution you mentioned. So how would i do this?

I tried to replace 32px with 100% but doesn't seem to do anything, i will continue to have a play with the code until i recieve a replya and if i solve it, i shall let you know :)

Jay

Me said on October 23, 2005

found this site thru a search, absolute most beeatiful perfectly designed site i've ever came across, simply outstanding, instant bookmark, no tables? thats crazy... thanks for the min-height hack also

Scott said on February 27, 2006

Anyone know if this works on the IE 7 beta?

Jonathan Snook said on February 27, 2006

It doesn't. height no longer acts like min-height in IE7. Unfortunately, as of Beta 2 Preview, min-height isn't available yet.

Dale said on May 26, 2006

With min-height likely to be available in the final release of IE7 (see http://blogs.msdn.com/ie/archive/2006/01/31/520883.aspx#522483 ) and height no longer acting like min-height in IE7, will this workaround cause problems when IE7 is released? I mean, do you know if IE7 will read both "height: expression('32px'); " and "min-height: 32px;" and then behave strangely, or will "expression" not be supported in IE7?

I'm not expecting anyone to know the answer to this just yet, as we only can find out what is released by Microsoft programmers and IE7 testers, but if someone does find out in future, it would be nice to know! Considering that Microsoft are trying to make their browser more standards compliant, I'm guessing it would be likely they would be removing some of these proprietary methods.

Andy said on September 15, 2007

It seems to me that conditional comments are the best solution to obtaining min-height in IE 6 and lower. Particularly because the 'expression' property is proprietary to M$ and will thus invalidate the style sheet.

-AP

Ahmet Maranki said on February 08, 2009

what a impressive article. last days I didn' t read post like that. I am now your blog' s follower thanks for this useful blog. you are now in my bookmarks.

Sorry, comments are closed for this post. If you have any further questions or comments, feel free to send them to me directly.

Want to learn about scaling CSS for large projects?

I'm available for full and half-day workshops on scalable CSS architecture. I can provide on-site training for your team. Interested?
Get in touch.