Skip to main content
HTML Validation

The “headers” attribute on the element “th” refers to the ID X, but there is no “th” element with that ID in the same table.

About This HTML Issue

Every ID in the headers attribute of a th has to be the id of another th in the same table, and the validator flags each one that isn't.

On a header cell, headers ties a sub-header to the header cells above it or beside it. When a "Sales" header spans the "Q1" and "Q2" columns, <th headers="sales">Q1</th> says that Q1 belongs to Sales. The value is a space-separated list of IDs, and the validator checks each one on its own, so a single cell can trigger this message more than once.

The referenced header is usually where things went wrong. The validator reports the ID when:

  • the group header has no id, or a different one (IDs are case-sensitive, so Sales doesn't match sales)
  • the id sits on a td styled to look like a heading, or on the tr, the thead or a span inside the th, instead of on the th itself
  • the th with that id belongs to another table, like a nested table or a separate table used as a fixed header row

Screen readers rely on these references to tell users which headers a cell falls under. When an ID doesn't resolve to a th, the sub-header loses its link to the group. Put the id on the group header's th, changing a td into a th if needed. If that header no longer exists, remove its ID from headers.

The standard also forbids a header cell that targets itself, either directly or through a chain of other headers' headers attributes. The validator doesn't report that loop, so check for it yourself when header cells point at each other.

Invalid example

<table>
  <tr>
    <td id="sales" colspan="2">Sales</td>
  </tr>
  <tr>
    <th headers="sales">Q1</th>
    <th headers="sales">Q2</th>
  </tr>
  <tr>
    <td>1200</td>
    <td>1350</td>
  </tr>
</table>

Valid example

<table>
  <tr>
    <th id="sales" colspan="2">Sales</th>
  </tr>
  <tr>
    <th headers="sales">Q1</th>
    <th headers="sales">Q2</th>
  </tr>
  <tr>
    <td>1200</td>
    <td>1350</td>
  </tr>
</table>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries