You should be able to do this with CSS using the max-width property.
However, IE6 won't understand max-width. You will need to use an expression, something like:
width:expression(document.body.clientWidth > 1024? "1024px": "auto" );
If you need further help, this should really be in the CSS forum.
Hope that helps! :)
Thank you TA.
Would it be possible for a mod to move this to the CSS forum please? saves starting a new one.
[edited by: Visit_Thailand at 1:01 am (utc) on Feb. 7, 2007]
Technically, this is what you would want to do:
As was said, this requires some basic CSS support. This should generally not be a problem, aside from IE 6 and earlier. For IE, take a look at Dean Edwards' IE7 library [dean.edwards.name].
Am I being thick? The code below is definitely working in FF, but IE7 doesnt limit the div's width to 500px, but set's it to 100%. I thought IE7 had support for this CSS property?
<title> new document </title>
at the risk of beginning to sound like a stuck record ;)
What's your Doctype?
can I please just repeat that support of newer properties (css enhancements) and features in IE6 AND IE7 is only possible with a Compliant/Strict rendering DOCTYPE
and designaweb you're not thick.. it's not just you - it's IE7 that's helping highlight something that was already there
see this post [webmasterworld.com] for some further reading
SuzyUK, thanks! :-)
using <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> now...
On this same subject may I ask whether there is any design danger using a min and max width like this?
My main concern is when someone sticks the site onto a massive display. Previously it would stretch and to be frank look ridiculous.
Is there any danger for regular monitors?
<breathing sigh of relief at the support of this property, finally>
No, it shouldn't, max-width should only kick in if the viewport . . . exceeds max-width. :-)
Thanks. So what do people believe should be the max-width?
My screen res is 1920x1200 and screens are getting bigger, especially with TV and flat screen monitors etc.
There does seem to be a general consensus when it comes to minimum but not much when it comes to max.
I do realise that it depends on how the site looks but what are your ideas as most sites will begin to look funny when expanded too much?