caption, thead, tbody, and scope
<table>
<caption>
<thead><tr><th scope="col">
<tbody><tr><th scope="row"><td>A data table with a caption, column headers, and row headers. This is not a layout grid.
| Attribute | Description |
|---|---|
caption | Optional first child. The title of the table. |
scope | On th: col, row, colgroup, or rowgroup. It identifies the header's direction, not a CSS class. |
headers | On td or th, a space-separated list of th id values for complex associations. Not needed in this simple example. |
colspan, rowspan | Positive integers that span cells. Use them for merged data cells, not for empty layout scaffolding. |
- thead, tbody, th, and td are covered here rather than on separate synonym pages. Catalog cards still link to these sections.
<table>
<caption>Weekly watering minutes by bed</caption>
<thead>
<tr>
<th scope="col">Bed</th>
<th scope="col">Monday</th>
<th scope="col">Thursday</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Herbs</th>
<td>10</td>
<td>8</td>
</tr>
<tr>
<th scope="row">Tomatoes</th>
<td>20</td>
<td>15</td>
</tr>
</tbody>
</table>What this markup means
The caption names the data set. thead holds column headers with scope="col". Each body row starts with a th that has scope="row". The numeric cells are td data, not layout spacers.
Related: Tag catalog: <table>, Tag catalog: <thead>, Tag catalog: <tbody>, Tag catalog: <th>, Tag catalog: <td>