Search code examples
cssuser-interfacefixed-widthvariable-width

(Fixed Width) vs (Variable Width) Website Design


I am learning how to design a website. One of the decision seems to be how to present the data to the user i.e. with the presence of different monitor sizes, whether to structure the data to occupy the entire screen (a.k.a GMail) or make it fixed width i.e. choose a standard monitor size (1024x768) and make it appear the same across all monitors (a.k.a. StackOverflow).

I am inclined towards Variable-Width design, what I am trying to understand is that what implications does this design decision have on programming? i.e. what do I have to keep in mind when I am programming a website with variable-Width design (to be specific - CSS usage) ?


Solution

  • I'm not a designer by any stretch, but I am doing a design for a site of my own I'm currently building. Take everything I say below with a couple large grains of salt.

    I think which width style you use depends largely on what sort of content you have, and how well it stretches.

    Gmail actually cheats (<div> elements have their width redefined in Javascript when the window width changes), but in principle this sort of design works because the sidebars are known quantities and the dynamic content wraps well. This means they can just throw in their sidebars at a fixed width, then use margins to make sure the content in the middle never overlaps with these sidebars. If the content grows too large, it simply wraps to the next line and nobody cares, because it's usually freeform text. If your site has a lot going on in its main content block, where there's real danger of content overflowing its container, variable widths probably aren't the right call. There are experts that can make these types of designs work, but if you're just starting out you might not want to try it. I tried it, and it only frustrated me.

    Fixed designs tend to be easier. I've likened it to just drawing a design on a piece of paper. Basically, you know the size of the paper (because you specified it explicitly), so when you draw a box, you know it won't overlap the box next to it because you also know where you drew that other box and where it's going to be. You just tend to have more absolute control over where things will ultimately get rendered on the page.

    The caveat to this is that you need to be aware that your chosen font sizes won't always be the ones used. A user can change the default font size the browser uses, making it bigger than you expect, causing your content to once again break out of their boxes. The way I tend to get around this is to test the design often using my browsers text-only zoom feature, and making sure that everything looks reasonable when the font increases 3-4 times.

    As far as choosing your "standard monitor size", the common practice now is to define your sites width to be 960px, give or take. This is about the right size for a viewport of 1024px width, once you factor in browser chrome (e.g. the vertical scrollbar). If you have a lot of users who might still use 800x600 resolutions, use a 760px design instead. It's still somewhat recommended to make sure your key content fits in 760px just in case, and use the remaining 200px for less critical content.

    Hope that helps a bit.