Chapter 12. Introducing CSS Layout

CSS leads a double life. As great as it is for formatting text, navigation bars, images, and other bits of a web page, its truly awesome power comes when you’re ready to lay out entire web pages. While HTML normally displays onscreen content from top to bottom, with one block-level element stacked after another, CSS lets you create side-by-side columns and position images or text anywhere on the page (even layered on top of other page elements), so you can create much more visually interesting web pages.

There’s a lot to CSS layout. This section of the book covers the most important CSS techniques in detail. This chapter provides a brief overview of the principles behind CSS layout and a handful of useful guidelines for approaching your own layout challenges.

Types of Web Page Layouts

Being a web designer means dealing with the unknown. What kind of browsers do your visitors use? Are they viewing your site on an Android phone or an iPad? The biggest issue designers face is creating attractive designs for different display sizes. Monitors vary in size and resolution, from 15-inch, 640x480 pixel notebook displays to 30-inch monstrosities displaying, oh, about 5,000,000x4,300,000 pixels. Not to mention the petite displays on mobile phones, and the small- to mid-range screens of tablets.

Web layouts offer several basic approaches to this problem. Nearly every page design you see falls into one of two types—fixed-width or liquid. Fixed-width designs give ...

Get CSS: The Missing Manual, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.