👀 Live Preview
Table with thead column headers and tbody data rows:
| First Name | Last Name | |
|---|---|---|
| John | Doe | john@example.com |
| Jane | Smith | jane@example.com |

The <thead> tag groups header rows in a table. This guide covers syntax, th cells, thead/tbody/tfoot structure, multi-level headers, CSS styling, accessibility, and best practices for beginners.
Row group element.
Column labels.
Headers vs data.
Inside table element.
colspan headers.
Semantic structure.
<thead> Tag?The <thead> tag is an HTML element used inside <table> to define the header section of a table. It groups one or more tr rows that contain th header cells, separating column labels from data in tbody.
thead wraps header rows with th cells. Pair it with tbody for data and tfoot for summaries when needed.
If you omit thead, browsers may still render header rows, but writing thead explicitly improves semantics, styling, and accessibility.
Place thead inside table with tr rows containing th cells:
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>
<tbody>
<!-- Data rows with td cells -->
</tbody>
</table><table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>john@example.com</td>
</tr>
</tbody>
</table>thead must be a direct child of table (along with caption, colgroup, tbody, and tfoot).tr elements go directly inside thead.thead before tbody and tfoot in source order.th (not td) for header cells inside thead.thead element.| Topic | Code Snippet | Notes |
|---|---|---|
| Basic thead | <thead>...</thead> | Header row group |
| Header cells | <th>...</th> | Inside tr |
| With tbody | thead + tbody | Headers + data |
| Multi-row | Multiple tr in thead | Grouped headers |
| vs th | thead = group | th = cell |
| Browser support | Universal | All browsers |
<thead>, <tbody>, and <tfoot>| Element | Contains | Typical cells |
|---|---|---|
<thead> | Header rows | th column labels |
<tbody> | Main data rows | td data values |
<tfoot> | Footer / summary rows | Totals, metadata |
| Order in HTML | thead → tbody → tfoot | Semantic grouping |
<thead> vs <th>| Element | Role | Analogy |
|---|---|---|
<thead> | Row group container for headers | The header section of the table |
<th> | Individual header cell | One column or row label |
| Relationship | thead contains tr → th | Section wraps cells |
The <thead> tag has no tag-specific attributes. Use colspan and rowspan on child th cells for complex headers.
<thead class="table-header">
<tr>
<th colspan="2">Merged Header</th>
<th rowspan="2">Spanned Header</th>
</tr>
</thead>class / id GlobalStyle all header rows in the thead section with one CSS selector.
class="table-header"colspan on th On thMerge header cells horizontally across multiple columns.
colspan="2"rowspan on th On thSpan a header cell vertically across multiple header rows.
rowspan="2"scope on th A11yDeclare column or column-group labels on th cells inside thead.
scope="col"Basic header sections, merged header cells, and multi-level header layouts with copy-ready code and live previews.
Table with thead column headers and tbody data rows:
| First Name | Last Name | |
|---|---|---|
| John | Doe | john@example.com |
| Jane | Smith | jane@example.com |
Use <thead> to group header rows, label columns with th, and build accessible table structure.
The primary purpose of thead is defining the header section of a table:
<table>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>john@example.com</td>
</tr>
</tbody>
</table>Use colspan and rowspan on th cells inside thead:
<thead>
<tr>
<th colspan="2">Merged Header</th>
<th rowspan="2">Spanned Header</th>
</tr>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>Use multiple tr rows in thead with colspan for grouped labels:
<thead>
<tr>
<th colspan="2">Personal Information</th>
<th>Email</th>
<th>Phone</th>
</tr>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Phone</th>
</tr>
</thead>th, not td, for correct semantics.scope="col" or scope="colgroup" for multi-level headers.tbody are associated with headers in thead.caption describes the table before users read individual headers.tr rows with th cells go inside thead.
thead headers and tbody data render as distinct row groups.
Classes on thead or th make headers visually distinct.
Column labels are semantically grouped, styled, and accessible to all users.
The <thead> tag is supported in all major browsers, including Internet Explorer.
All browsers render <thead> as the standard table header row group.
Bottom line: Use <thead> confidently to group table header rows in any browser.
The <thead> tag is essential for well-structured HTML tables. By grouping header rows with th cells separately from body data, you improve clarity, styling control, and accessibility in tabular content.
thead with th on every data tablethead before tbody in source orderthead with CSS for visual header distinctioncolspan and rowspan for multi-level headersthead using td cellsalign or valign on thead<thead>Bookmark these before you structure your next HTML table.
Row section.
PurposeColumn labels.
ContentData section.
PairingGroup vs cell.
ComparisonClear structure.
A11yAll browsers.
Compatibilityth cells that label each column.tr rows with th header cells. Data rows belong in tbody with td.thead is the row group container. th is the individual header cell inside it.tr rows for multi-level headers with colspan and rowspan on th cells.Practice <thead> with <th> and <tbody> in the Try It editor.
6 people found this page helpful