Chapter 17. Tables

Tables visually show relations between pieces of data. Lists do the same, but tables allow you to show multiple relations at the same time. Each cell in a table holds a number or some short text that has some relation to other data in the same column or the same row.

To make it easier to see the structure of the table, rules (i.e., lines) are often added between the rows or columns (or both), sometimes only between certain groups of rows or columns. Colors and changes in font can, of course, also be used. Cells don’t have margins (although there is a cell-spacing property that works in a somewhat similar way), but padding is available.

CSS2 offers two ways of setting borders on cells. In one model, called collapsing borders ...

Get Cascading Style Sheets: Designing for the Web, Third Edition 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.