HTML and CSS Reference
■ IE 6 handles this layout with surprising equanimity. The only adjustments it needs are a fixed width for the
wrapper<div > and an empty <div > to clear the footer. you can examine the details in threecol.html.
Using CSS Table Display for Layout
The reason HTML tables were so widely used—misused, some would say—for page layout is because table
cells automatically expand to the height of the tallest cell in a row and the width of the widest cell in a column.
This made it easy to keep elements in alignment, but it also led to fiendishly complex structures, with tables
nested inside tables. Using the table-related values of the CSS display property allows you to reap the alignment
benefits of table layout without resorting to HTML tables. However, it's not a perfect solution. If you're not
careful, there's a danger of creating a complex structure that has all the accessibility problems associated with
HTML table layouts. I've seen examples of pages that use dozens of <div> elements with tablerow and tablecell
classes. It would have been much simpler to use <tr> and <td> tags, and give up the pretence of using CSS.
Used correctly, CSS table display gives you the best of both worlds by allowing ordinary HTML elements to
act like table rows and cells. Although it can be used for page layout, it's also suited to aligning form elements
horizontally and vertically.
■ CSS table layout is supported by all mainstream browsers in widespread use, including IE 8 and later.
none of the examples in the rest of this chapter work in IE 6 or IE 7. References to “all browsers” mean “all browsers
in widespread use except IE 6 and IE 7.”
Table 12-1 lists the table-related values of the display property, together with their HTML equivalent and
Table 12-1. Table-related Values of the display Property
Makes the element act like an HTML table. Child elements are
treated as table rows and/or cells.
Same as table , but the element is displayed as an inline block.
Makes the element act like a table row. Child elements are
treated as table cells.
Makes the element act as a group of one or more table rows.
Makes the element act as a table header.
Makes the element act as a table footer.
Used internally by browsers to hide <col> elements.
Used internally by browsers to hide <colgroup> elements.
Makes the element act as a table cell.
Makes the element act as a table caption.