HTML and CSS Reference
padding: 0 1.5% 10px 1.5%;
As you might expect, this produces a three-column layout like Figure 12-11 . In most browsers, it's correctly
centered when the viewport is wider than 1200px . However, in WebKit-based browsers (Chrome and Safari), it
fills the entire width of the screen.
■ The conclusion that can be drawn from the preceding examples is that the most reliable and efficient way
of creating a single row of equal height columns with CSS table display is to use display: table-cell on its own.
Just wrap the elements that you want to display as columns inside another block element, but don't change the
display property of the outer element.
Combining Columns with a Header and Footer
The primary purpose of the preceding examples was to demonstrate the effect of anonymous table objects, but
layouts that consist solely of columns are relatively unusual. It's more common to mix columns with elements
that stretch the full width of the page. So, the following examples expand the HTML in Listing 12-1 to include a
header and footer at the top and bottom of the page, using the structure in Listing 12-2.
Listing 12-2. Three-column Layout with Header and Footer
<p>The balanced scorecard. . . </p>
The header and footer are inside the wrapper<div> , and are siblings of the sidebars and main content.
Header, Footer, and Table Cells Only
The styles in table-cells_hf.html are the same as in table-cells.html with the addition of some basic styling for the
header and footer. The display property of the sidebars and main content is set to table-cell , but the header
and footer styles affect only colors, margins, and padding.