The HTML headers attribute
The HTML headers attribute associates a data cell with its header cells by their ids, for accessibility in complex tables. It is used on the <td> and <th> elements.
Overview
The headers attribute links data cells to header cells for accessibility. It is used on the <td> and <th> elements.
It defines table structure: spanning cells across rows or columns, and connecting data cells to their headers. These attributes are central to making data tables understandable to screen-reader users.
Syntax
<th id="q1">Q1</th> … <td headers="q1">100</td>
Values
| Value |
|---|
| A space-separated list of header cell ids. |
Best practices
Accessibility
In complex tables where scope is not enough, headers explicitly ties each data cell to its header cells so screen readers announce the right context.























