Headings
<table>
<tr>
<th></th>
<th scope="col">Column A</th>
</tr>
<tr>
<th scope="row">Row 1</th>
<td>Cell A1</td>
</tr>
</table>
You should use table headings or <th>
elements to provide structure and style to head your columns and rows. This is incredibly helpful for people who use screen readers and helps search engines index your page correctly.
We delineate columns and rows using the scope=""
attribute; a column is headed using <th scope="col">...</th>
and a row is headed using <th scope="row">...</th>
IMPORTANT: Empty cells are not forgotten cells - they still need to be created using <th>
or <td>
elements. Not including these elements will cause your table to be rendered improperly.
- Previous
- Next