Skip to main content

The <thead> Element

As defined in the HTML Living Standard, the <thead> element represents the block of rows that consist of the column headings (header) for the parent <table> element.

Visual Example:

Standard Version Release Date
WCAG 2.1 June 2018
HTML5 Living Standard Rolling
<table> <thead> <tr> <th scope="col">Heading 1</th> <th scope="col">Heading 2</th> </tr> </thead> <tbody>...</tbody> </table> View HTML Living Standard: The thead element

Structural and Semantic Purpose

The <thead> element is part of the table sectioning model. It provides several technical advantages over simply using <tr> tags:

WCAG Requirement: Info and Relationships

Success Criterion 1.3.1 (Level A): Information, structure, and relationships conveyed through presentation can be programmatically determined.

Grouping headers within <thead> allows user agents to handle the table structure more robustly. For example, some browsers and printer drivers will repeat the <thead> content at the top of every new page when a table spans multiple pages. This ensures the relationship between headers and data remains perceivable to the user, regardless of where they are in a large dataset.

Understand SC 1.3.1: Info and Relationships

Styling with SMACSS

The <thead> element is a convenient hook for applying styles to the entire table header at once.

thead th { position: sticky; top: 0; background-color: var(--color-primary); z-index: 10; }

A11y Tip: Logical Fragments

Ensure that all headers within the <thead> use the <th> element with the appropriate scope="col" attribute. The <thead> provides the container, but the <th> provides the link between the category and the data.