Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

thead — table header row group

The `thead` element groups rows containing a table's column labels. Individual header cells use `th`.

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

Syntax

<thead>
  <tr><th scope="col">Label</th></tr>
</thead>

thead groups column headers and ancillary table cells. It does not turn td into headers: use th; scope="col" identifies a column header.

A table permits at most one thead, after caption and colgroup, before tbody, tfoot, and direct tr children. Its content is zero or more tr and script-supporting elements, not direct cells.

It supports global attributes and uses HTMLTableSectionElement. In text/html, its start tag is required; its end tag is omissible only immediately before tbody or tfoot. The example retains both tags.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Table header example</title>
<table>
  <thead>
    <tr><th scope="col">Item</th><th scope="col">Count</th></tr>
  </thead>
  <tbody>
    <tr><td>Pen</td><td>3</td></tr>
  </tbody>
</table>
</html>

Result

The browser displays a table with column headers “Item” and “Count” and one data row: “Pen” under “Item” and “3” under “Count”.

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