A summary of CSS-based layout techniques
Over the past few months, I've mentioned in my weblob a number of new and exciting layout techniques that have surfaced. Below is a summary of the traditional CSS-based, tableless layouts, and these new techniques that you as a web designer would hopefully consider while planning a standards-compliant site. I've also included what I believe are the pros and cons of each technique, links to examples, and where possible have credited their author and/or origins. This summary is a WIP.
I've used the word 'viewport' in the context of the browser size and not screen resolution.
If you can't figure out the rendering differences between the techniques, you may want to try each at different viewport sizes (increase your screen resolution and/or browser width) and at different browser text sizes. Use this bookmarklet (drag it onto your Bookmarks Toolbar or into your Favourites) to easily resize your browser width.
I'd like to keep this list fresh, factual and unbiased - please comment or drop me an e-mail if you have something to contribute. And no debates over personal preference, please.
- Fixed: layout is determined by absolute dimensions, typically to fit a viewport with a width of around 800 pixels. With 1024x768 resolutions gaining popularity, there is a growing trend to design exclusively for this size.
Pros: Easy to implement.
Cons: Supports single scenario only. Typically breaks when browser text size is adjusted.
Examples: news.com (800), download.com (1024), theonion.com (1024), macromedia.com (800), 24sata.hr (1024), bmw.com (1024) - Liquid (aka. Fluid): layout is determined by relative dimensions, typically percentage values to fit 100% of the viewport.
Pros: Accommodates all viewports. Larger volume of content is viewable without scrolling. Scalable and flexible for forward-compatibility.
Cons: On wide viewports, readibility suffers from long lines of text.
Examples: wired.com, sercotransarctic.com - Resolution dependent (by Cameron Adams): varying layout according to viewport width. When the width is adjusted, the layout is dynamically adjusted accordingly. JavaScript required, but degrades gracefully.
Pros: Full control over how changes in the viewport have an effect on the content. Flexible.
Cons: Time-consuming, more maintenance required.
Examples: Author's demo, rammstein.com, smh.com.au, microsoft.com (last two require browser reload). - Elastic (by Patrick Griffiths and more recently, Roger Johansson, and again by Douglas Bowman): resizes to browser font size. Similar to Opera's zoom function.
Pros: Takes the user's preference into account. Flexible. Accessible.
Cons: Time-consuming, more maintenance required. Difficult to make images scale.
Examples: mozilla.org, yahoo.com, aol.com, Elastic Lawn (CSS Zen Garden) - Jello (by Michael Purvis): a combination of Fixed and Liquid.
Pros: Scalable and flexible for forward-compatibility.
Cons: Steep learning curve.
Example: Author's demo. - Progressive (by Alessandro Fulciniti): a combination of Fixed and Liquid. A Fixed layout under and over certain pixel widths, while Liquid inbetween. JavaScript required, but degrades gracefully.
Pros: Scalable and flexible for forward-compatibility.
Cons: Steep learning curve.
Example: Author's demo. - Constrained (aka. Untitled): Liquid layout up to a maximum pixel width.
Pros: Scalable and flexible for forward-compatibility.
Cons: uses IE's proprietary CSS rule to emulate max-width property.
Example: This site.
- comments are closed
18 Comments
thanks 4 THIS post coda – some excellent references!
Bit of the ol’ censorship never hurt anyone eh ?
Nice one on the layout breakdown, I’m thinking of moving away from the boring old fixed layout to something more ‘fluid’, so it’s good to know what my options are…
Lovely stuff…
I have always had a vague idea of the different layout types/styles in my mind, but I could never properly place or name them, till now. I’ve even learned a couple of new ones.
Thanks for sharing the wonderful world of web standards.
disappointing… where is my “blah blah” skip option…
I’ve loved all implementations of resolution dependent layouts I’ve seen so far, particularly Benjamin Adam’s
Absolutely useful information, but lol @ gill…
Very good post.
Interesting links of the examples that make you understand what you are talking about.
Really good.
This is an excellent reference post, thanks so much for that.
Your feed definitely going to my bloglines.
Cheers
Good summary, and thanks for the link… quite apart from the technical prowess required, there’s definitely a design challenge involved in creating something that’s expandable on two dimensions.
But it’s good to see some folks looking back that way.
Simple test
Wow. This is exactly what I needed. I’ll have to play around with some of the newer techniques. Thanks for posting this!
Great example, thanks James
Interesting use of layout techniques. I have certainly learnt from this post.
What’s your position on 1024 – having mentioned it in one of your examples. Is the world ready for it?
Matt: One can argue that screen resolution trends reveal an increasing number of users with 1024, but that doesn’t necessarily mean their browser window is maximized. I’ve read a couple of times that some users prefer to keep their browser window at 800 irrespective of their resolution. Conversely, I always maximize mine because I prefer to view a site minus any background distraction – so my browser’s viewport is 1400 wide. Sites designed for 800 fixed width suffer at this size, because they don’t benefit from my extra screen realty.
I want to avoid debates on preference but for interest’s sake, the reasoning above is why I keep to liquid layouts that are constrained to a maximum width, and resize to accomodate smaller widths. We have the technologies and methods to apply this concept across all popular browsers and user preferences, so there’s no excuse to design for fixed widths anymore.
The question shouldn’t ask if the world is ready for 1024, but rather if your website is ready for 1024. And 800. And 640.
I sound like a stuck record when I repeat this, but it’s so true: design to accommodate your users and not their resolution/browser/os/etc.
FInalleeee, someone has been nice enough to actually explain all the types of css layouts!, thanks so much
Very nice blog! Thanks Coda! View my http://www.autogirl.info
17 June 2005
jawrr03:28 am
Me like, really love this blog… havn’t read very many of yours so far but this one really make me want to read more. In the move to create my own right now in fact…
This part about the layouts kan be real handy and I already use the “viewport”-script. Maybe I even want to say; Thank you… THE WORLD SHOULD THANK YOU! :P
Well, I’ll just sleep tight right night…