Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max Width 1

Status
Not open for further replies.

fatcodeguy

Programmer
Feb 25, 2002
281
CA
Hi,

I want my page to have relative width up to a certain maximum. For example.. in 800x600 and 1024x768 resolution, I want 100% width, but anything larger I want to limit to 800px wide (or so).

How do i do this?

Thanks for the help!
 
with two separate stylesheets.

you can then call a javascript function when the page loads that will determine the size of the user's screen and apply the necessary stylesheet.

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Assuming you made a mistake in explaining the widths, since I don't know why 1024 users get full screen and 1280 users get 800px instead of at least 1024. Property max-width will give you exactly what you want, but alas it is not supported in the most widely used browser. For that specific browser you need to employ a little hack but it is very very easy and degrades nicely:
Code:
body {
  width: 100%;
  max-width: 1024px;
  width: expression(document.body.clientWidth > 1024? "1024px": "100%" );
}
 
Vragbond [smarty][smarty] Is there something that you dont know?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top