We Recommend

CSS: The Definitive Guide CSS: The Definitive Guide
Provides you with a comprehensive guide to CSS implementation, along with a thorough review of all aspects of CSS 2.1. Updated to cover Internet Explorer 7, Microsoft's vastly improved browser, this new edition includes content on positioning, text wrapping (nowrap), lists and generated content, table layout, user interface, paged media, and more.


Posted By

travis on 06/29/06


Tagged

css minheight


Versions (?)


Who likes this?

14 people have marked this snippet as a favorite

jamesmcoats
meth
postNuKe
jkochis
fatihturan
basicmagic
tavo
purpleraison
SpinZ
marcoba
celoria
ds
johnself
esquareda


simple min-height for all browsers


Published in: CSS 


This snippet uses html>body instead of * html. Works in all modern-browsers, degrades to just height for older browsers.

  1. #minHeightItem
  2. {
  3. height: 100px; /* this is the height that IE6 and other older browsers will use */
  4. }
  5.  
  6. /* "html>body" is preferred over other methods because it is valid CSS, it doesn't have problems with specificity that other methods have, and it is forwards compatible */
  7. html>body #minHeightItem
  8. {
  9. height: auto; /* reset the height for compliant browsers */
  10. min-height: 100px;
  11. }

Report this snippet 

You need to login to post a comment.