MainelyDesign.com Blog

Faking min-width CSS style in IE6 and IE7

Posted on 07/16/2009 at 01:50 pm by Kevin Wentworth
Viewed 12,642 times | 0 comments

It's a hack... but it's needed to make a truly cross-browser fluid layout.  It's simple, if you want to implement min-width in IE6 and IE7, use the following CSS code: (I didn't create this originally, sorry, lost the source)

  1. /*********************
  2. **  IE 6.0 min-width hack
  3. ********************/
  4. * html div#contentWrap {
  5.     width:expression(((document.compatMode && document.compatMode=='CSS1Compat') ? document.documentElement.clientWidth : document.body.clientWidth) < 1000 ? "840px" : "85%");
  6. }

Just make sure you actually specify the min-width for all other browsers:

  1. div#contentWrap {
  2. position: relative;
  3.  margin: 0px auto;
  4.  padding: 0px;
  5.  width: 85%;
  6.  min-width: 840px;
  7.  text-align: left;
  8.  z-index: 1;
  9.  
  10. }

That's it.

Cheers,

-Kevin Wentworth

Bookmark and Share

Tags for Faking min-width CSS style in IE6 and IE7

Css | Web Design | Hack | Internet Explorer | Ie

Comments for this Posting

No comments. Be the first to post a reply.

Sorry, comments are closed for this posting.

Please Email Kevin if you have any questions. Thanks!

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design