Open In App

What is the use of scope Attribute in HTML Tables ?

The “scope” attribute is a feature in HTML tables that allows you to specify the relationship between a header cell (th) and its associated data cells (td). This attribute provides useful information for assistive technologies, and it improves the accessibility and understanding of tabular data.

Note: By using “scope”, you can indicate whether a header cell applies to a row, column, group of columns, or group of rows.

Syntax

<th scope="row/column/rowgroup/colgroup">Header Content</th>
Key Point Description
Row Scope Specifies that the header cell applies to the row(s) containing the associated data cells.
Column Scope Indicates that the header cell applies to the column(s) containing the associated data cells.
Rowgroup Scope Specifies that the header cell applies to a group of rows, serving as a header for the entire rowgroup.
Colgroup Scope Indicates that the header cell applies to a group of columns, serving as a header for the entire colgroup.
Accessibility The “scope” attribute enhances the accessibility of tables by providing context and relationships between header and data cells to assistive technologies such as screen readers.
Article Tags :