Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

scope — table header scope

The scope attribute on th identifies which cells a table header applies to: cells in a row, column, or corresponding group. It describes semantic relationships rather than appearance or cell merging.

Version: WHATWG HTML Living Standard; index snapshot date recorded separately

Syntax

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

scope is an enumerated attribute of th, not td. It defines a header's scope in the table model, helping establish cell context, including during nonvisual presentation.

The value row covers some subsequent cells in the same rows, while col covers some subsequent cells in the same columns. rowgroup and colgroup apply to the remaining cells in the corresponding group, according to the table model.

For rowgroup, the header must be anchored in a row group (thead, tbody, or tfoot); for colgroup, it must be anchored in a column group defined by colgroup. colspan alone does not create a column group. scope does not merge cells: colspan and rowspan do that.

An omitted attribute or invalid value selects the Auto state: associations are determined from context. auto is not an allowed keyword. In complex tables, explicit associations can be expressed with headers, referencing the id values of th headers in the same table.

Examples

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Table headers</title>
</head>
<body>
  <table>
    <caption>Points</caption>
    <thead>
      <tr><th scope="col">Name</th><th scope="col">Score</th></tr>
    </thead>
    <tbody>
      <tr><th scope="row">Ada</th><td>12</td></tr>
    </tbody>
  </table>
</body>
</html>

Result

Points
Name  Score
Ada   12

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources