The Parts of a Data Table
The best understanding of data table markup begins with an examination of the smaller parts of a table, as illustrated in Figure 10-1.
Figure 10-1. Data table anatomy
- Rows and cells:
tr
andtd
These will typically contain all of the data points that relate to a single item. Rows are themselves divided into cells (
td
), and analogous cells in separate rows are always rendered into consistent columns. Apart fromtbody
, rows and cells are the two elements that must be present in a table.Readers who are familiar with relational databases will recognize that
tr
elements signal the bounds of a single record.- Columns and column groups:
col
andcolgroup
Just as a row relates to a single item, a column relates to a common class of data. Each column in a table corresponds to the table cells found at an interval of
n
, given thatn
equals the number of cells in each row.- Row and column headings:
th
th
functions as an alternative totd
, and defines the character of data found in a particular row or column.th
elements are distinct fromtd
elements not only in terms of presentation, but also because they are set aside specifically to create table cells that do not contain actual data.- Captions:
caption
Headings are assigned to normal copy; in spite of their name,
caption
s serve an analogous role for data tables. They are always rendered at the top of tables, as a heading would be ...
Get HTML & CSS: The Good Parts 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.