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
2010-04-02 16:42:47
Thanks!! Will this work in all browsers?
ensnare
2010-04-02 16:45:27
Including IE6 ?
ensnare
2010-04-02 16:45:43
I'm afraid IE 6 isn't supported. There are workarounds, however: http://www.doxdesk.com/software/js/minmax.html
Ayman Hourieh
2010-04-02 16:47:26
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
2010-04-02 16:43:38
+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
2010-04-02 17:17:27
So max-width is recognized by IE6? width:expression only needs to be specified for min-width? Thanks!
ensnare
2010-04-02 18:32:05
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
2010-04-02 19:27:20
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
2010-04-02 19:28:05
and the site i used for this example is http://www.olatheks.org if you want to check how it works.
Peter Carrero
2010-04-02 19:29:27