views:

1456

answers:

6

I have a client with a resolution Width of 1200 on their monitor and I need to maximize the width of my web site but I don't want the client to have to use the horizontal scroll bar. What is the max width you can use in a website in IE 7 with a screen resolution of 1200 without needing to use a horizontal scroll bar(Other users will have a larger width and all users must have the same width)?

Extra info- The web site is already built and can not use a width of 100% as this has bad consequences in a non textual web site. Yes the resolution is a width of 1200 (the client has a 1920 X 1200 resolution monitor that is set on its side).

The OS is Vista and as the client is government he will have Vista at least through 2010 and can not change his theme/browser etc.

+1  A: 

Just don't hardcode any pixel widths?

Joey
A: 

It doesn't seem likely that you're going to get it down to the exact pixel; since users can change their Windows theme, the right-hand scroll bar can vary in width.

Most websites I have seen do this allow their website to "float" into the width of the page by using CSS.

Robert Harvey
My user in fact can not change their theme and the scroll bar width will not vary as all machines will have the exact same configuration
runxc1 Bret Ferrier
+7  A: 

how about:

body{
  width:100%;
}

and by this I mean, let the user size their browser to whatever they want, and make your content fit their screen.

Update:

As users have noted below, sometimes 100% is a bit too much... for those cases I would highly recommend this article & demo by Cameron Adams (The Man In Blue) that applies fluid layouts that re-arrange the content/CSS bases on the width of the browser.

scunliffe
You would get my entire daily allotment of votes for this, if I could vote more than once.
Software Monkey
that might be the politically correct response but it's rarely practical. Making even a moderately complex design with a fluid width that meets a clients design requirements is extremely difficult. Most designs look crap beyond about 1500px because paragraphs tend to become long lines and whitespace and color blocks overpower the text. Images are usually too short and tiling becomes repetitive. Case in point, other than /. how many good commercial sites have you seen with a truly fluid width?
SpliFF
btw, I have a 30"" screen. Trying looking at some 100% width sites with the browser maximised to 2560px and you'll see what I'm talking about. 100% width is a universally bad design. If you insist on fluid width at least put a reasonable px based max-width in as well.
SpliFF
I can understand that sometimes you do have to meet some whacky requirement like "The application must be fixed width and no greater than the smallest screen on campus" (I've had my share of endless meetings with government clients with specs worse than that).A content website like a blog I think should typically have a max-width, but a web application should be 100% fluid. When was the last time you opened up desktop software and it was fixed width?
rpflo
Fullscreen 3D games? (ie, pretty much any modern game is fixed-width).
SpliFF
IIRC this gets you a horizontal scroll bar at least in IE 6, unfortunately.
Joey
@Johannes - I should clarify that I believe that setting a maximum width to an exact pixel dimension has cons. I would suggest setting a width/layout that is flexible... such that if I have a 1024x768 screen it looks good, ditto if I have a 1600x1200 screen. A tweak for IE6 to avoid scrollbars may also be needed but usually it is the vertical scrollbar that messes up the horizontal width in IE. As for @SpliFF he has a point too. I've updated my answer to include some great design links for dynamic layouts.
scunliffe
@ SpliFF - Touche, I wasn't even considering games since it's so out of context with this question. So, aside from games, when was the last time you opened a desktop app that was fixed width?
rpflo
+1  A: 

Simple, the maximum width is 100%.

Seriously though, what possible reason could you have for designing a website to the scale of a single persons single computer? What happens when they buy a new computer?

I design any fixed-width sites to roughly 900-1000 px and center it. This is the general approach taken by most sites and I strongly recommend not straying from it unless your design is capable of using percentage widths. Your client will understand if you explain it in these terms and show them any of the thousands of popular sites following this behaviour.

SpliFF
No, make a resizing website that changes with the window width.
Software Monkey
+4  A: 

You asked two questions, really. To answer the title question:

20px (IE7, Windows XP, Default Theme)

Everybody else has done a great job of answering the real question.

rpflo
+1  A: 

If you don't want to set the body width in css to 100%, then set it at about 95%. That will still allow the page to expand/contract to the end-user's desired width, down to only 400 width without a horizontal scroll.

The following formula should work for you, whether you use it for minimum or maximum page widths.

$safe_PgWidth_Percentage = (1 - (20/$minPageWidth));

While users in a restricted environment may not be able to change their operating system, browser, etc. I cannot imagine that they would not be able to grab the corner of their browser window and reduce or enlarge it by dragging.

That's the point your commentors are making. Coding the body to a percentage, in fact as close as possible to 100%, takes care of useability issues, including fixing your horizontal scrolling dilemma.

Fran Corpier
Upvoted for the mention of user, well, 'use.'
David Thomas