Structuring Tables

The kind of information you put in a spreadsheet is usually suitable for presentation in an HTML table.

At the most fundamental level, a table element is made up of rows of cells. Each row (tr) contains header (th) or data (td) cells, or both. You may also provide a table caption if you think it’ll help your visitors better understand the table. Furthermore, the scope attribute—also optional, but recommended—informs screen readers and other assistive devices that a th is the header for a table column (when scope="col"), for a table row (when scope="row"), and more (see the last tip) Image.

Each row is marked by a tr element. This ...

Get HTML5 and CSS3: Visual QuickStart Guide, Seventh Edition now with O’Reilly online learning.

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