Home HTML Tags <thead> HTML <thead> Tag Definition
Definition and Usage The <thead> element groups the header rows of a <table> . Those rows usually hold column titles made with <th> inside <tr> elements.
Pair it with <tbody> for data and <tfoot> for summaries. A table may have only one <thead>. Place it after any <caption> / <colgroup> , and before tbody, tfoot, and bare rows. On printouts, the head often repeats on each page.
Baseline · Widely available. Not deprecated. Core thead support has been stable across browsers since about July 2015 (and much earlier in practice).
Deprecated attributes. Do not use align, bgcolor, char, charoff, or valign on <thead>. Prefer CSS text-align, background-color, and vertical-align.
Syntax
HTML Syntax The start tag is required. The end tag may be omitted when <tbody> or <tfoot> follows immediately, but writing both tags is clearer. Content is zero or more <tr> rows.
Reference
Attributes Modern <thead> has no current element-specific attributes — only global attributes . These older attributes are deprecated (shown for migration):
Attribute Description Try it alignDeprecated — use CSS text-align instead Try itbgcolorDeprecated — use CSS background-color instead Try itvalignDeprecated — use CSS vertical-align instead Try itchar / charoffDeprecated — use CSS text-align (and tabular numerals) instead Try it
Inside the head, use scope on <th>, and colspan / rowspan for multi-row headers.
Try it
Live Preview Switch column titles inside a real <thead>.
Code
HTML Examples Short, copy-ready snippets. Use Try It Yourself for a live editor.
1. Basic thead 2. With scope 3. Multi-row head 4. With tbody & tfoot Example 1 — Basic thead Put column titles in <thead> and data rows in <tbody>.
<table>
<thead>
<tr>
<th>Student ID</th>
<th>Name</th>
<th>Credits</th>
</tr>
</thead>
<tbody>
<tr>
<td>101</td>
<td>Ada</td>
<td>240</td>
</tr>
<tr>
<td>202</td>
<td>Grace</td>
<td>220</td>
</tr>
</tbody>
</table> Student ID Name Credits 101 Ada 240 202 Grace 220
How It Works Open <thead> for the header group.Add one <tr> of <th> column titles.Put data in <tbody> so body rows stay separate.Style thead without touching data cells.Example 2 — scope on Header Cells Mark each column header with scope="col" for clearer accessibility.
<table>
<thead>
<tr>
<th scope="col">Item</th>
<th scope="col">Cost</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Snacks</th>
<td>40</td>
</tr>
<tr>
<th scope="row">Travel</th>
<td>120</td>
</tr>
</tbody>
</table> Item Cost Snacks 40 Travel 120
How It Works Keep titles in thead with <th>.Set scope="col" on each column header.Optional row headers in the body use scope="row".Assistive tech can announce the right header for each cell.Example 3 — Multi-row thead Use two header rows with colspan and rowspan so columns still line up.
<table>
<thead>
<tr>
<th scope="col" rowspan="2">ID</th>
<th scope="col" colspan="2">Student</th>
<th scope="col" rowspan="2">Credits</th>
</tr>
<tr>
<th scope="col">First</th>
<th scope="col">Last</th>
</tr>
</thead>
<tbody>
<tr>
<td>101</td>
<td>Ada</td>
<td>Lovelace</td>
<td>240</td>
</tr>
</tbody>
</table> ID Student Credits First Last 101 Ada Lovelace 240
How It Works Put both header rows inside one thead (still only one head group).rowspan="2" makes ID and Credits cover both header rows.colspan="2" makes Student cover First and Last.Keep the column count equal in every body row.Example 4 — thead with tbody and tfoot Use all three section groups for head, data, and total.
<table>
<caption>Council budget</caption>
<thead>
<tr>
<th scope="col">Item</th>
<th scope="col">Cost</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Stationery</th>
<td>18,000</td>
</tr>
<tr>
<th scope="row">Snacks</th>
<td>3,000</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row">Totals</th>
<td>21,000</td>
</tr>
</tfoot>
</table> Council budget Item Cost Stationery 18,000 Snacks 3,000
How It Works caption names the table.thead holds column labels; tbody holds items.tfoot holds the total after the body.Semantics help screen readers, CSS, and multi-page print layouts. Edge Cases & Pitfalls Most thead mistakes are order rules, duplicate heads, or weak header cells.
limits Only one thead per table Put every header row inside that single group. Do not stack multiple thead elements.
order Place head before body After caption/colgroup: thead, then tbody / tfoot. Keep that order in the markup.
cells Prefer th in the head Column titles belong in <th>, not bold td cells, so assistive tech can treat them as headers.
spans Keep multi-row math valid With colspan/rowspan, every body row must still match the full column count.
attrs Skip deprecated align / bgcolor Style the head with CSS. Presentational attributes on thead are obsolete.
Compatibility
Browser Support The <thead> element is core HTML table markup in every browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
<thead> Widely available since about July 2015 (and long before). Grouping header rows helps CSS, accessibility, and multi-page printing.
98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported <thead> Widely supported
Bottom line: Safe to use for column header groups. Prefer one thead with th cells, place it before tbody, and style with CSS.
Remember
Key Takeaways Role: <thead> groups the table’s header rows.
Cells: put column titles in <th> (often with scope="col").
Limit: only one thead; multiple tr rows are fine inside it.
Order: after caption/colgroup, before tbody and tfoot.
One line: put column header rows in a single <thead> before your data rows.
UA style
Default CSS Settings Typical user-agent styling for thead (simplified; exact rules vary by browser):
thead {
display: table-header-group;
vertical-align: middle;
border-color: inherit;
} Style head cells with selectors like thead th. When printing long tables, browsers may repeat the head on each page.
Frequently Asked Questions What is the HTML thead tag used for? The thead element groups the header rows of a table — usually column titles made with th. It works with tbody and tfoot to mark clear table sections.
Is thead required? No. Simple tables can use only table, tr, th, and td. Use thead when you want a clear header group for styling, printing, and accessibility.
Can a table have more than one thead? No. A table may have only one thead (and only one tfoot). You can have multiple consecutive tbody sections.
Where should thead go in the markup? Inside table, after any caption and colgroup, and before tbody, tfoot, and bare tr rows.
Can thead contain more than one row? Yes. Put multiple tr elements inside thead for multi-level headers. Use colspan and rowspan on th so columns line up.
Should I use align or bgcolor on thead? No. Those attributes are deprecated. Style the header with CSS such as background-color, text-align, and vertical-align.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
12 people found this page helpful
Helpful Share Copy link Suggestion