Most the CSS3 techniques we’ve gone over so far have been purely cosmetic effects that aid progressive enhancement. But CSS3 can also be used to improve the usability of your pages.
Creating Multiple Columns of Text
Aids in: progressive enhancement, adaptability
Some pieces of text are more readable in narrow, side-by-side columns, similar to traditional newspaper layout. You can tell the browser to arrange your text into columns by either defining a width for each column (thecolumn-width property) or by defining a number of columns (the column-count property). Other new properties let you control gutters/gaps, rule lines, breaking between columns and spanning across columns. (For now, you need to use the browser-specific prefixes of -moz and -webkit.) This is another one of those techniques that can harm instead of aid usability if used improperly, as explained in “CSS3 Multi-column layout considered harmful,” so use it judiciously.
For details, see:
- Remembering: The CSS3 Multi-Column Layout Module (Web Designer Notebook)
- Columns (quirksmode)
- Take Your Design To The Next Level With CSS3
Controlling Text Wrapping and Breaking
Aids in: adaptability
CSS3 gives you more control over how blocks of text and individual words break and wrap if they’re too long to fit in their containers. Setting word-wrap to break-word will break a long word and wrap it onto a new line (particularly handy for long URLs in your text). The text-wrap property gives you a number of options for where breaks may and may not occur between words in your text. The CSS2 white-space property has now in CSS3 become a shorthand property for the new white-space-collapse and text-wrap properties, giving you more control over what spaces and line breaks are preserved from your markup to the rendered page. Another property worth mentioning, even though
it’s not currently in the CSS3 specification, is text-overflow, which allows the browser to add an ellipsis character (…) to the end of a long string of text instead of letting it overflow.
For details, see:
- Mozilla Developer Center’s reference on
word-wrapandwhite-space(relevant to non-Mozilla browsers, and includes notes on browser compatibility) - How to prevent HTML tables from becoming too wide (using
word-wrapandoverflowfor various browsers, from 456 Berea Street) - Wrapping Text Inside Pre Tags (using
white-spaceandword-wrapfor various browsers, from Unwakeable) - The ‘white-space’ Property In CSS (Safalra’s Website)
- CSS text-overflow (css3.com)
- Using ellipsis with HTML and CSS (The Electric Toolbox)
- The Future Of CSS Typography
Media Queries
Aids in: adaptability, efficiency
CSS2 let you apply different styles to different media types — screen, print, and so on. CSS3’s media queriestake this a step further by letting you customize styles based on the user’s viewport width, display aspect ratio, whether or not his display shows color, and more. For instance, you could detect the user’s viewport width and change a horizontal nav bar into a vertical menu on wide viewports, where there is room for an extra column. Or you could change the colors of your text and backgrounds on non-color displays.
This demo file from Opera uses media queries to rearrange elements and resize text and images based on viewport size.
Media queries couldn’t come at a better time — there is more variety in the devices and settings people use to browse the web than ever before. You can now optimize your designs more precisely for these variations to provide a more usable and attractive design, but without having to write completely separate style sheets, use JavaScript redirects, and other less efficient development practices.
Media queries are supported to some degree by all the major browsers except IE, and there are lots of great articles and tutorials explaining how to use them right now:
- A short introduction to media queries in Firefox 3.5 (applies to other browsers too, from Mozilla Hacks)
- Safe media queries (Opera Developer Community)
- The bleeding edge of web: media queries (Helephant.com)
- Media Queries and CSS3 Experiments — Varying Columns (Unintentionally Blank)
- CSS3 – a big storm is coming (Reinhold Weber) and Using CSS3 media queries to achieve multiple columns on browser resize (mindgarden) show how to use the new multiple columns technique described above in conjunction with media queries
- Take Your Design To The Next Level With CSS3
- Test your browser’s media queries support at Virtuelvis
Media queries are particularly helpful in serving alternate styles to small-screen mobile devices, as these articles and tutorials explain:
- Return of the Mobile Stylesheet (A List Apart)
- Coding for the mobile web (Think Vitamin)
- How to serve the right content to mobile browsers (Opera Developer Community)
- Optimizing Web Content (on iPhone, from Safari Web Content Guide)
- Mobile optimised websites using CSS3 Media Queries (Alex Gibson)
- Determine iPhone orientation using CSS (The CSS Ninja)
For other options on how to deal with mobile devices, see Mobile Web Design Trends For 2009.

