A cell's headers attribute must point to header cells in its table
When a cell uses the `headers` attribute, each id it lists must belong to a header cell in the same table, so screen readers announce the right headers for that cell.
| Rule ID | td-headers-attr |
|---|---|
| Impact | Serious |
| Success criterion | 1.3.1 Info and Relationships · A |
| Standards | WCAG 2.0 · WCAG 2.1 · WCAG 2.2 · Section 508 · EN 301 549 |
| Fixed automatically |
Example
<table>
<tr><td></td><th id="adult">Adult</th><th id="child">Child</th></tr>
<tr><th id="day">Day pass</th><td headers="day adults">€24</td><td headers="day child">€12</td></tr>
</table>On “€24”, a screen reader announces only “Day pass, €24”, dropping the “Adult” column.
<table>
<tr><td></td><th id="adult">Adult</th><th id="child">Child</th></tr>
<tr><th id="day">Day pass</th><td headers="day adult">€24</td><td headers="day child">€12</td></tr>
</table>A screen reader announces “Day pass, Adult, €24”.
Why it matters
In complex tables, with merged cells or several levels of headers, browsers cannot always work out which headers belong to which cell. The headers attribute lets you state that link directly: each data cell lists the ids of its headers, and screen readers read those headers aloud when the user reaches the cell.
That explicit link replaces the browser's own guesswork. So when an id is misspelt, points to a cell in another table, points to a data cell, or points to the cell itself, the screen reader reads the wrong context or none at all. A blind user checking a train timetable or a financial report hears figures with missing or misleading labels and can draw the wrong conclusions.
Sighted users never notice the problem, which is why broken headers references often survive for years.
How to fix it
Check each headers attribute against the ids of the table's header cells.
Typo or renamed id. Make the id in headers match the header's id exactly. Ids are case-sensitive:
<th id="adult">Adult</th>
<td headers="day adult">€24</td>
Reference to a <td>. If the referenced cell is a header, change it to <th>. If it is data, remove its id from the list.
Header in another table. Move the header into the same table, or repeat it there. A cell can only reference headers inside its own <table>.
Cell refers to itself. Remove the cell's own id from its headers list.
Empty headers="". Remove the attribute, or fill in the correct ids.
Simple table. If the table has one header row and maybe one header column, you often do not need headers at all. Use scope instead, which is shorter and harder to break:
<th scope="col">Adult</th>
When tables are generated by code, build the ids and the headers lists from the same variables so they always match.
Checklist
- Match every id in headers to a th id.
- Keep referenced headers inside the same table.
- Never let a cell reference itself or a td.
- Prefer scope for simple tables.
How the check works
The check looks at every table and each visible cell with a headers attribute. It fails when a listed id does not belong to a cell in the same table, belongs to a cell that is not a header, or is the cell's own id. An empty headers value is flagged for review. The check cannot tell whether the right headers were chosen: verify that manually.
Resources
- Understanding 1.3.1 Info and Relationships W3C
- W3C ACT rule a25f45 W3C ACT
- Tables with multi-level headers W3C WAI
- Tables with irregular headers W3C WAI
Updated October 27, 2026