HTML / Element / Initial coverage

The <th> Element

Status: Initial coverage Scope: HTML Living Standard Specification checked: 2026-10-05

Technical Summary

The th element represents a header cell in a table. The distinction between a header and data cell is part of the table model, not a visual style. The table model uses scope, headers, cell coordinates, and spans to determine which headers are assigned to each cell.

scope describes simple row and column headings. For a table whose relationships cannot be described by direction alone, simplify the structure first, then consider explicit links with id and headers. Evaluate HTML-AAM role mappings separately from observations in each browser and assistive technology.

Definition / Content model

Basic definition of the th element
ItemDefinition
MeaningA header cell in a table
ContextAs a child of a tr element
Content modelFlow content, without header, footer, sectioning, or heading content descendants
CategoriesNot classified into a specific content category
Key attributesGlobal attributes, colspan, rowspan, headers, scope, and abbr
DOM interfaceHTMLTableCellElement, the same interface used by td

Header cells and data cells are both cells in the table grid. A th is a header cell and a td is a data cell; the table model uses that distinction when forming header relationships.

scope and header types

scope keywords and meanings
KeywordHeader directionCondition
rowData cells in the same rowDeclares a row header
colData cells in the same columnDeclares a column header
rowgroupData cells in the same row groupThe cell belongs to a row group
colgroupData cells in the same column groupThe cell belongs to a column group

When scope is missing or has an unrecognized value, its state is Auto. Auto is a specification state, not a literal attribute value. In this state, the table model uses the cell's position and factors such as whether data cells appear above or beside it to determine the header direction. A cell cannot use the rowgroup or colgroup state unless it belongs to that group.

HTML-AAM maps a computed header type to the columnheader or rowheader role. The role, relationships, and announcements exposed by an implementation must be observed separately from the HTML-AAM mapping.

Automatic header assignment

When a cell has no headers attribute, the HTML Standard's “Forming relationships between data cells and header cells” algorithm assigns headers using the cell's coordinates in the table grid. At a high level, it scans left along the same row and upward along the same column, and also considers row-group and column-group headers selected by scope.

<table>
  <thead>
    <tr><th scope="col">Product</th><th scope="col">Price</th></tr>
  </thead>
  <tbody>
    <tr><th scope="row">Apple</th><td>$1.20</td></tr>
  </tbody>
</table>

In this example, “$1.20” is related to both the column heading “Price” and the row heading “Apple”. rowspan and colspan change the grid slots occupied by a cell, so they affect header assignment. Do not infer the full relationship from source order alone; inspect the normative algorithm and implementation results separately.

Explicit associations with id and headers

For a cell that specifies headers, the browser splits the value on ASCII whitespace and uses the resulting ID tokens to form its header list. Each token must refer to a th in the same table, and a cell must not target itself. The specification also defines relationships that continue from one header cell through that header's own headers attribute.

<table>
  <thead>
    <tr><th id="cost" scope="colgroup" colspan="2">Cost</th></tr>
    <tr>
      <th id="base" scope="col" headers="cost">Base fee</th>
      <th id="extra" scope="col" headers="cost">Extra fee</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th id="plan" scope="row">Plan A</th>
      <td headers="plan cost base">$10.00</td>
      <td headers="plan cost extra">$2.00</td>
    </tr>
  </tbody>
</table>

Conforming markup uses unique IDs from the same table and should be checked for correct references. First consider whether the table itself can be simplified. WAI authoring guidance uses scope for simple tables and id with headers when multi-level or multidirectional relationships require explicit links.

Key attributes and DOM interface

Attributes on th and shared cell attributes
AttributeScope and notes
scopeKeywords: row, col, rowgroup, and colgroup. Missing or unrecognized values use Auto state.
headersAvailable on td and th. A token list referring to th IDs in the same table.
abbrAn alternative label for the header when it is referenced in another context. It need not be an abbreviation.
colspan / rowspanThe number of table-grid columns or rows occupied by the cell. Check limits and row-group boundaries.

HTMLTableCellElement exposes attributes such as cellIndex, colSpan, rowSpan, headers, scope, and abbr. Reflection of the headers and scope strings in the DOM is a different surface from a browser's header relationships in its accessibility API.

Fact / Evidence

Specification claims are linked to their scope and source location. Browser, WPT, and accessibility measurements are recorded separately under Implementation Evidence. Unmeasured scope stays listed under Coverage / Open Issues.

Key facts and evidence locations
TypeFactCondition / ScopeStatusEvidence
SPECth represents a header cell in a table.The element is a child of tr; its context and content model are considered.ReviewedHTML Standard: the th element
SPECThe four scope keywords select row, column, or group header states; a missing or unrecognized value uses Auto state.The rowgroup and colgroup states require the cell to belong to the matching group.ReviewedHTML Standard: the th element
SPECheaders references space-separated IDs of th elements in the same table and must not target the cell itself.The token processing and header list are evaluated when the attribute is specified.ReviewedHTML Standard: header and data cell semantics
SPECThe accessibility role for th maps to a column header or row header according to its header type.HTML-AAM separates column / column group headers from row / row group headers.ReviewedHTML-AAM: th element
SPECabbr can provide an alternative label when a header cell is referenced in another context.How a specific browser or assistive technology uses the label requires separate observation.ReviewedHTML Standard: the th element

Evidence

  1. HTML Standard: The th element — meaning, context, content model, scope, abbr, and DOM interface
  2. HTML Standard: Attributes common to td and th — rowspan, colspan, headers, and cellIndex
  3. HTML Standard: Header and data cell semantics — header types and the data/header relationship algorithm
  4. HTML Accessibility API Mappings: th — computed role and platform mapping
  5. WAI Tables Tutorial — authoring guidance for simple and complex header relationships

Implementation Evidence

Browser, WPT, accessibility API, and assistive-technology results are recorded separately from specification claims. The entries cover selected fixtures, tests, and environments; they do not imply the same result in every implementation.

Implementation evidence registry for the th element
TypeReproducible scopeConditions to recordStatus
IMPL DOM reflection for scope, headers, abbr, rowSpan, and colSpan, plus header ID references within the same table 2026-10-05 / Codex In-app Browser, Chrome UA 154.0.0.0, viewport 870×668, navigator.language=ja. Eight of eight checks passed in build-config/yugien/research-results/th-v1/ at 127.0.0.1:4194. Checked scope (col / row / colgroup), headers, abbr, rowSpan, and colSpan. One environment only. Partial observation (Chrome 154 / one environment)
WPT Selected WPTs for cellIndex on table cells including th, and the table row cells collection 2026-10-05 / Codex In-app Browser, Chrome UA 154.0.0.0 / wpt.live. cellIndex.html: 6/6 passed. cells.html: 1/1 passed. Total: 7/7 passed. The upstream revision served by wpt.live was not pinned. Automatic header assignment via scope, complex-table header assignment, and other browsers were not tested.

The test version used was not recorded. The linked test may change, so this result cannot be repeated with certainty against the same version.

Partial run (7/7 passed)
AAM Browser accessibility roles and names for table, columnheader, rowheader, cell, and caption name. Screen reader speech was not checked. 2026-10-05 / Codex In-app Browser, Chrome UA 154.0.0.0, Windows NT 10.0 UA, viewport 870×668. Playwright browser accessibility role/name queries observed 3 tables, 16 rows, 10 columnheaders, 12 rowheaders, and 24 cells. The “Fruit prices today” caption matched as the table accessible name, and header names were available. This is a browser AX observation, not a screen-reader speech check. NVDA or another screen reader was not tested. Windows UI Automation was excluded at the user's request. Partial observation (browser AX; speech untested)

WPT execution, browser accessibility tree, Windows UI Automation, and NVDA observations are recorded as separate measurements. Selected tests do not establish full WPT conformance.

Coverage / Open Issues

  • ReviewedMeaning, context, key attributes, scope states, same-table constraint on headers tokens, and basic HTML-AAM role mapping
  • OpenAll header assignment branches, nested headers, duplicate IDs, and exhaustive rowspan / colspan limits and boundary cases
  • OpenOnly selected WPT coverage. Other browsers, the full WPT suite, all Windows UIA properties, and assistive technologies other than NVDA remain untested.
  • OpenUse of abbr in speech, announcement order for complex tables, browser / assistive-technology combinations, and Expert-gap Review

This is initial coverage. The recorded observations do not claim that every table structure, browser, and assistive technology exposes the same header relationships.

Related surfaces

For a beginner-friendly heading example and the use of scope, see the th element in Yugien. For a beginner-friendly data-cell example, see How to Use the td Element; the specification and evidence are in the td Topic. The table title and accessible-name mapping are covered in the caption Topic; for the full table model and parser recovery, see the table Topic.