Save the Internet: Click here


Kickass Web Design creates Custom Themes and Templates for WordPress, Cubecart, ModX, Movable Type, ZenCart, Joomla, Tolranet Directory Script and other web applications. We can match your current design or create something totally new and different. Interested? Request a Custom Template Quote.


IE6 Min-height ‘Hack’ that isn’t

Now that IE7 recognizes the min-height but so many people are still using IE6, how do we make sure that IE6 “gets” min-height without hacking?

According to Shelly on the CSS-Discuss list, the cleanest simplest way is to use the cascade and the fact that IE6 treats height as if it’s min-height.

First you use this AT THE END OF your stylesheet:

html, body {
height: 100%;
min-height: 100%;
}

Then you follow it with whatever div you wish to also be full height.

div#mainwrapper {
height: 100%;
min-height: 100%;
}

Because IE6 doesn’t understand min-height it instead reads and uses height, while all other browsers will follow the cascade and use min-height instead. This allows us to get IE6 in line without conditionals or hacks, and yet feed all browsers exactly what they need.

Technorati Tags:

Share this post:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blogmarks
  • del.icio.us
  • digg
  • Furl
  • NewsVine
  • Spurl
  • YahooMyWeb

4 Responses to “IE6 Min-height ‘Hack’ that isn’t”

  1. Mike Says:

    A sometimes simpler and safer solution is to create an element with 0 width and x height, and float it left inside the container element. sometimes the above mentioned solution will mess up a site design, specifically when using things such as bottom absolutely positioned elements i.e. for footers.

  2. BJ Says:

    Absolute Positioning? That creates a whole lot more problems than this non hack does.

  3. Anja Says:

    i was looking for this solution and it worked like a charm for me. had to add // like this though:
    html, body {
    //height: 100%;
    min-height: 100%;
    }
    because without that, firefox thought it was height 100%, which it takes as absolute i think.

  4. BJ Says:

    Anja, the cascade is feeding the good browsers min-height, which they understand. Only IE6 is getting height.

Random Posts from my Portfolio

Three New Sites Launch on Kickass Custom Wordpress Themes
macmikenews250.jpg