The HTML scope attribute
Quick answer
The HTML scope attribute declares whether a header cell applies to a row, column, or group. It is used on the <th> element.
Overview
The scope attribute states what a table header cell labels. It is used on the <th> element.
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 scope="col">Name</th>
Values
| Value |
|---|
| row | col | rowgroup | colgroup |
Best practices
Accessibility
Adding scope to header cells is the simplest way to make a data table accessible; screen readers use it to announce the relevant header when reading each cell.
Frequently asked questions
What does the scope attribute do?
States what a table header cell labels.
How do I make a data table accessible?
Which elements use the scope attribute?
It is an element-specific attribute, used on the <th> element.