PDA

View Full Version : CSS Page Width - Percent or Pixels?



NTxNerd
07 Apr 2008, 09:24 AM
Hey guys,

Okay, I'm working on completely revamping my site (http://www.northtexasnerd.com). Here's my question - When working with CSS and page width, should I set it to a percent (Example 75% or should I set to a certain pixel width such as 750 pixels)?
If so, what percent or what pixel width is going to work the best with all screen sizes.. or atleast most.


Thanks again guys!

Wickham
07 Apr 2008, 09:56 AM
Percentage widths for a whole webpage worked reasonably well a few years ago but more and more people are using large resolution monitors so a flexible page now needs to look good for old computers using 500px wide or 800*600 screen resolutions right up to 1920*1200, so the answer is to test your design at these resolutions. It will be difficult to get it looking good at all resolutions.

You can use min-width and max-width and perhaps set min-width at 780px width and max-width at say 1180px (allowing 20 px for a vertical scrollbar in 800 and 1200px wide resolutions).

http://www.wickham43.supanet.com/tutorial/maxminwidth.html

However, min-width and max-width don't work in IE6 so you will need to fix the width in a conditional comment just for browsers IE6 or less. If you don't state a width for IE6 it just uses either the max-width or min-width as a fixed width, I can't remember which it uses.

http://www.wickham43.supanet.com/tutorial/generaladvice.html#conditionalcomments

Put the conditional comment in the head section after the main stylesheet link with the min-width and max-width.