views:

78

answers:

3

For example, dynamic and fluid between 600px - 1000px, but fixed at 1000px after 1000px and fixed at 600px below 600px. Check out digg.com for an example. I'd like a way that is cross-browser compatible. Thank you!

+5  A: 

Use the min-width and max-width CSS properties.

body {
  min-width: 600px;
  max-width: 1000px;
}

IE6 doesn't support these properties, but newer versions (IE7+) do. All other major browsers support them.

Ayman Hourieh
Thanks!! Will this work in all browsers?
ensnare
Including IE6 ?
ensnare
I'm afraid IE 6 isn't supported. There are workarounds, however: http://www.doxdesk.com/software/js/minmax.html
Ayman Hourieh
A: 

CSS is the way to go! This is a no-brainer. Try using a class like:

.style { min-height: 600px; max-height: 1000px; }
themoondothshine
+2  A: 

here is the code i used in a elastic-width with limits site to get it to comply - even on ie6 (the width:expression line is there for ie6):

min-width: 900px;
 max-width: 1280px;
 text-align: left;
 width:expression(document.body.clientWidth < 990? "990px": "auto" );
Peter Carrero
So max-width is recognized by IE6? width:expression only needs to be specified for min-width? Thanks!
ensnare
no, max-width is not recognized by ie6 (sadly). that min-width expression is on a page wrapper div (lets call it container). then container is inside another wrapper (lets call it container2) that has the max-width expression below: width:expression(document.body.clientWidth > 1280? "1280px": "auto" ); text-align: center;
Peter Carrero
so the full code for both divs is:#container2 { width:expression(document.body.clientWidth > 1280? "1280px": "auto" ); text-align: center;}#container, { min-width: 900px; max-width: 1280px; text-align: left; width:expression(document.body.clientWidth < 990? "990px": "auto" ); }
Peter Carrero
and the site i used for this example is http://www.olatheks.org if you want to check how it works.
Peter Carrero