Q: Liquid layouts
by Mike Slocombe
Q: I've skimmed through Jakob Nielsen's book Homepage Usability, and he encourages the use of a 'liquid' layout for a Web page, so the content fits the screen regardless of resolution. May I ask how this can be done?
<body onload="moveTo(0,0); resizeTo(screen.availWidth,screen.availWidth)">
Although some newbies might think this effect is 'WaY K3wL', my advice is never to use it. Forcing a browser to hog the entire screen just to display your precious site is rude and arrogant - I like to choose the size of my browser, thanks.
if (screen.width == 1024)
if (screen.width == 800)
if (screen.width == 640)
if (screen.width <= 639)
For more on this, see Post by Screen Size.
Stretchy style sheets
A far better approach is to create a 'liquid' layout which will fill whatever browser space is available (so that the user can choose how wide they want to view your site).
The best way to do this is to use style sheets to create dynamic layouts by specifying percentages in HTML DIVs. Be aware that browser compatible issues may result in inconsistent displays, particularly on older browsers.
There's some great tutorials and downloadable template layouts here:
From Table Hacks to CSS Layout: A Web Designer’s Journey
CSS Layout Techniques: for Fun and Profit
Mighty expanding tables
Perhaps the easiest way to make your pages dynamically fit a screen is to specify <TABLE> dimensions in percentages, creating a 'liquid' effect that makes the page expand or contract depending on the width of the user's browser.
For more on HTML tables, see www.htmlhelp.com.
For more on getting rid of table margins, see www.htmlhelp.com/faq/html/, and for more on style sheets and tables, see www.w3.org/TR/REC-CSS2/tables.html.
I'd also recommend making the fonts on the page resizeable. See www.wilk4.com/webdevres/.