Chapter 9. How Do I Style Tables?

Tables seem to be the most divisive of all HTML elements—you either love 'em or hate 'em. For years, they were the only way to build a grid structure to lay out web pages. But tables work in a unique way. The height of each row is determined by the tallest object in the row, and the width of each column is determined by the widest object in the column. Just when you think you have everything nicely aligned, you add something slightly bigger in a table cell, and the whole table structure shifts.

Thankfully, tables are no longer necessary—or indeed recommended—for page layout. Normally, they should be used only for the display of data that needs to be presented in a grid format—timetables, price lists, sports results, ...

Get Getting StartED with CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.