The <table> Element
Technical Summary
The table element represents multidimensional data as a table and participates in a table model formed by descendant rows, columns, and cells. Rows and columns form a grid, and cells must cover that grid without overlap.
A table represents data relationships; it is not a general-purpose page-layout container. Use CSS Grid, Flexbox, or another CSS layout system for layout.
Definition / Content model
| Position | Element | Meaning | Condition |
|---|---|---|---|
| 1 | caption | A description of the table | Optional; first |
| 2 | colgroup | A group of columns | Zero or more |
| 3 | thead | A group of heading rows | Optional |
| 4 | tbody or tr | The table body | Zero or more tbody, or one or more tr |
| 5 | tfoot | A group of footer rows | Optional |
The table content model has this order. Script-supporting elements can be interspersed where the model permits them. Neither the table start tag nor its end tag is omissible.
Table model
The table model is not simply a copy of the source markup's visual nesting. Rows and columns form a grid, and cells occupy slots in that grid.
source markup
↓ rows / columns / cells
table grid
↓ cell slots and spanning relationships
table model
- GridRows and columns form a two-dimensional grid.
- CellsCells cover the grid without overlapping one another.
- SpanAll branches involving
rowspanandcolspanrequire further detailed review.
Header / Data cell relationships
| Markup | Role | Relationship | Use it for |
|---|---|---|---|
th scope="col" | Column header | Describes cells in a column | Prices, dates, item names |
th scope="row" | Row header | Describes data in a row | Days, products, regions |
td | Data cell | Contains data described by headers | Values, states, descriptions |
id + headers | Explicit association | Associates headers explicitly in a complex table | Multiple heading levels or axes |
Heading relationships are structural; they are not created by bold text or borders. In a simple table, scope is a readable starting point. In a complex table, simplify the structure where possible and use id and headers when an explicit association is needed.
Parser recovery boundary
The HTML parser does not always copy source nesting directly into the DOM. For example, a td directly under tbody is a parse error. In the table-body context, the tree builder can insert an implied tr and then reprocess the td token through a recovery branch.
<table>
<tbody>
<td>source cell</td>
</tbody>
</table>
possible DOM shape after recovery:
table → tbody → tr → td
Source-markup parentage and the DOM tree after parsing are therefore separate inspection targets. Conformance and observed parser recovery should not be treated as the same claim.
DOM interface
A table element is exposed through the HTMLTableElement interface. The interface defines surfaces such as caption, tHead, tFoot, tBodies, and rows, as well as operations such as createTBody() and insertRow().
const table = document.querySelector('table');
table.caption;
table.tBodies;
table.rows;
table.insertRow(-1);
DOM API results depend on the DOM tree constructed by the parser and on the runtime state created by later operations, not only on the original source text.
Fact / Evidence
Key facts are mapped to their conditions, review status, and evidence locations. Unresolved scope remains visible in the Coverage section below.
| Type | Fact | Condition / Scope | Status | Evidence |
|---|---|---|---|---|
| SPEC | The table element represents data relationships, not general page layout. | Use it for row-and-column data; use CSS layout systems for page layout. | Reviewed | HTML Standard: the table element |
| SPEC | The table content model has the order caption, colgroup, thead, table body, and tfoot. | The body is zero or more tbody elements, or one or more tr elements. | Reviewed | HTML Standard: the table element |
| SPEC | Rows, columns, and cells form a table grid whose slots are covered without overlap. | rowspan and colspan affect the grid and require branch-specific review. | Reviewed | HTML Standard: forming a table |
| SPEC | th and its heading relationships describe the data cells in a simple or complex table. | Use scope for simple row or column headers; use id and headers when explicit associations are needed. | Reviewed | HTML Standard: header and data-cell semantics |
| SPEC | The parser can insert an implied tr when a td appears directly in a table-body context. | This is a parse-error recovery path; source nesting and the resulting DOM must be inspected separately. | Reviewed | HTML Standard: in table body |
Evidence
- HTML Standard: The table element — meaning, content model, table model, layout-table boundary, and DOM interface
- HTML Standard: Forming a table — formation of table grids, rows, columns, cells, and slots
- HTML Standard: Header and data cell semantics — header and data-cell relationships
- HTML Standard: The table-body insertion mode — token processing and recovery boundaries in table contexts
- HTML Accessibility API Mappings: table — an entry point for platform accessibility mapping
Implementation Evidence
Implementation observations are recorded separately from normative claims. Unrun items are not treated as reviewed.
Shared fixture / environment: A table omitting tbody with scoped headers, rowspan="2", and headers. Chrome 152.0.0.0 / Windows NT 10.0 / checked 2026-09-13.
| Type | Reproducible scope | Record required | Status |
|---|---|---|---|
| IMPL | Parser recovery, table grid, rowspan/colspan, and constructed header relationships | Chrome 152.0.0.0 / Windows NT 10.0 / 2026-09-13. The omitted tbody was inserted implicitly; the result had three rows, rowspan=2, and colspan=1. The scope values (col/row) and td[headers]="h1 r1" were retained. | Reviewed |
| WPT | Tests related to table parsing, grid formation, and header association | Mapped to foster-parenting-moved-table.window.js, rowspan-0.html, col-span-limits.html, and cells.html. On 2026-09-15 in Chrome 152.0.0.0 / Windows NT 10.0, rowspan and cells passed 3/3, while col-span passed 3/5 (two width assertions differed from Chromium's measured values). foster-parenting-moved-table.window.js could not be opened by the browser runner and remains unrun. | Partial (6/8 pass) |
| AAM | Accessibility-tree observations for table, row, column, and header relationships | Chrome 152.0.0.0 / Windows NT 10.0 / 2026-09-13. The AX tree exposed a table, rows, and cells with their names. In this Chromium tree, the th elements appeared as cells rather than separate columnheader / rowheader roles, so complete header mapping is not claimed. | Observed |
Use the WPT repository for test mapping and HTML-AAM for accessibility criteria.
Coverage / Open Issues
- ReviewedThe element's meaning, content model, basic table grid, simple header/data relationships, and the main HTMLTableElement surface
- ReviewedThe implied-row parser recovery boundary in the table-body context
- OpenAll rowspan/colspan branches, the complete table-model algorithm, and complex header association
- OpenThis AX observation covers one Chrome environment only. Complete HTML-AAM mapping, assistive-technology observations, browser divergence, WPT, and historical changes remain unregistered.
- OpenThe implementation boundary between CSS table layout and the HTML table model, compatibility, and Expert-gap Review
This page is initial coverage. It does not claim that every fact about the table element has been verified or that every implementation produces the same result.
Related surface
For a minimal example, headings, and responsive-table guidance, see the table element page in Yugien.