Skip to content

09. Tables

martin@mustbebuilt.co.uk edited this page Sep 1, 2024 · 1 revision

HTML tables can be made more accessible. The A11Y checklist highlights:

  • Use the table element to describe tabular data.
  • Use the th element for table headers (with appropriate scope attributes).
  • Use the caption element to provide a title for the table.

Check any tables for accessibility and add <th> table header element for cells that act as table headers and use the scope attribute to indicate that they are heading for the columns ie:

<tr>
       <th scope="col">Qualification</th>
       <th scope="col">Subject</th>
       <th scope="col">Grade</th>
       <th scope="col">Date</th>
</tr>

You could also add a <caption> element that is placed immediately after the <table> element.

Clone this wiki locally