HTML <th> scope Attribute

Last Updated : 22 May, 2026

The scope attribute in the <th> tag defines the relationship between a header cell and the data cells it applies to. It helps browsers and screen readers understand table structure.

  • Specifies the scope of a header cell (e.g., row, col, rowgroup, colgroup).
  • Helps define which cells the header applies to.
  • Improves accessibility for screen readers.
  • Used only with the <th> element.

Syntax:

<th scope="col | row | colgroup | rowgroup">

Attribute Values:

  • col: It specifies that the header cell is used for column.
  • row: It specifies that the header cell is used for row.
  • colgroup: It specifies that the header cell is used for group of column.
  • rowgroup: It specifies that the header cell is used for group of row.
html
<!--Driver Code Starts-->

<!DOCTYPE html>
<html>

<head>
    <title>
        HTML th scope Attribute
    </title>
</head>

<body>
    <h1>GeeksforGeeks</h1>

    <h2>HTML th scope Attribute</h2>

<!--Driver Code Ends-->

    <table border="1" width="500">
        <tr>
            <th scope="col">NAME</th>
            <th scope="col">AGE</th>
            <th scope="col">BRANCH</th>
        </tr>

        <tr>
            <td>Ben</td>
            <td>22</td>
            <td>CSE</td>
        </tr>

        <tr>
            <td>Ron</td>
            <td>25</td>
            <td>EC</td>
        </tr>
    </table>

<!--Driver Code Starts-->
</body>

</html>

<!--Driver Code Ends-->
Comment