HTML <th> scope attribute

Definition and Usage

scope The attribute specifies whether the header cell is the title of a column, row, or both column and row groups.

Note:scope The attribute has no visual effect in ordinary web browsers, but it can be used by screen readers.

Detailed Explanation

Using scope The attribute can link data cells with header cells.

Through the attribute value row, all tables included in the header row will be linked with the header cells. Specifying col will bind all cells in the current column with the header cells.

Using rowgroup and colgroup will bind all cells and header cells in the row group (defined by <thead>, <tbody>, or <tfoot> tags) or column group (defined by <col> or <colgroup> tags) together.

Example

Example: Specifies that two header cells are the titles of columns:

<table>
  <tr>
    <th></th>
    <th scope="col">Month</th>
    <th scope="col">Savings</th>
  </tr>
  <tr>
    <td>1</td>
    <td>January</td>
    <td>¥3000</td>
  </tr>
  <tr>
    <td>2</td>
    <td>February</td>
    <td>¥4000</td>
  </tr>
</table>

Try It Yourself

Syntax

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

Attribute Value

Value Description
col Specifies that the cell is the title of a column.
row Specifies that the cell is the title of a row.
colgroup Specifies that the cell is the title of a group of columns.
rowgroup Specifies that the cell is the title of a group of rows.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support