O'Reilly logo

CSS3 Foundations by Ian Lunn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

chapter eight

Creating a Multicolumn Layout

One of the most common layouts in web design is a multicolumn layout. By giving a web page columns, you can separate content into relevant sections, making better use of the space available.

Multicolumn layouts are most commonly achieved using the float property, which technically was never added to the CSS specification for the purpose of creating robust, multicolumn layouts. Its true purpose is actually quite a simple one: to allow one element to flow next to another. Creating multiple columns via the use of float, clear, and other properties is really a “hack”—you’re making use of something in the way it wasn’t intended—but it’s a hack that is needed because CSS, as yet, offers very little in terms of enabling the creation of multicolumn layouts.

css3_badge.psd  CSS Level 3 sees the introduction of flexbox (www.w3.org/TR/css3-flexbox) and regions (www.w3.org/TR/css3-regions), modules that aim to improve how columns and content areas are created on a web page. Unfortunately, both of these modules are in working draft and have little to no support in modern browsers, so they can’t be used on a working website.

Currently, each element on the Cool Shoes & Socks web page vertically follows the next. In this chapter, you learn the basics of the float and clear properties and then combine these properties along with others to place elements side by side ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required