HTML / Element / Initial coverage

The <tr> Element

Status: Initial coverage Scope: HTML Living Standard Specification checked: 2026-10-11

Technical Summary

tr represents one row in a table and contains the row's td and th cells. Its rowIndex is measured against the table's rows, while sectionRowIndex is measured against its parent's rows collection. The parent is usually a row group, but it can be the table itself when the context allows it.

When source markup puts a tr directly under table, the parser inserts an implicit tbody into the DOM. This is a difference between source text and the parsed DOM. Browser observations and WPT results are recorded separately from the role mapping defined by HTML-AAM.

Definition, context, and content model

Basic definition of the tr element
ItemSpecification summaryCondition / scope
MeaningA row of cells in a tableThe cells carry their own data or heading meaning through td or th
ContextChild of thead, tbody, or tfoot; it may also be a child of table under specific conditionsThe table must have no tbody child; the order relative to other children also matters. HTML markup has an additional syntax restriction
Content modelZero or more td, th, and script-supporting elementsAn empty row is permitted by this content model
Content categoryBelongs to no specific categoryDefined separately as part of the table model
Content attributesGlobal attributesNo tr-specific content attributes are defined
End tagMay be omitted under conditionsWhen immediately followed by another tr, or when the parent has no more content
DOM interfaceHTMLTableRowElementProvides row positions, a cell collection, and cell insertion and deletion

The HTML Standard's content model has a conditional case for a tr child of table, but its HTML syntax conformance rules say that a table must not contain a tr directly. For source markup that does so, the parser inserts a tbody start tag. New markup is easier to read when its row groups are explicit.

Row groups and parser construction

Elements that group table rows
ElementRole in the tableRelationship to rows
theadHeading part of the tableContains heading rows
tbodyMain body of the tableMultiple row groups can separate parts of the data
tfootSummary part of the tableContains summary rows
<table>
  <thead><tr><th>Item</th><th>Value</th></tr></thead>
  <tbody><tr><th>Total</th><td>3</td></tr></tbody>
</table>

Each tr in this example has a row group as its parent. A cell with rowspan="0" spans the remaining rows in the same row group, so group boundaries affect the table model when a table has multiple tbody elements.

HTMLTableRowElement and row APIs

Main IDL members for a table row
MemberValue or behaviorScope / boundary
rowIndexPosition in the table's rows collectionZero-based; -1 when the row is not associated with a table
sectionRowIndexPosition in the parent table or row group's rows collectionZero-based; -1 without a matching parent
cellsAn HTMLCollection of the row's child td and th elementsCells inside a nested table are not included
insertCell(index)Creates and inserts a new tdDefault is -1; an out-of-range index throws IndexSizeError
deleteCell(index)Removes the td or th at the given position-1 removes the last cell; an out-of-range index throws IndexSizeError
const row = document.querySelector("tbody tr");
row.rowIndex;          // Position in the whole table
row.sectionRowIndex;   // Position in its parent tbody
row.cells;             // This row's th and td elements
row.insertCell(-1);    // Append a td
row.deleteCell(-1);    // Remove the last cell

rowIndex is not a visual column position or a section-local number. When a table has several row groups, keep the whole-table and parent-group indexes separate. If a row is a direct child of a table, sectionRowIndex uses the table's rows collection. Also, insertCell() always creates a td.

Accessibility role

HTML-AAM maps the implicit role of tr to row. Exposure in a browser Accessibility tree, values in a platform API, and speech from an assistive technology are different measurements. The Implementation Evidence below records only the environments and scope actually observed.

Facts / Evidence

Key specification claims are mapped to their conditions and source locations. Implementation observations, WPT runs, and Accessibility role queries are recorded separately below.

Main facts and source locations for tr
TypeFact / claimCondition / scopeStatusEvidence
SPECtr is a table row whose children are td, th, and script-supporting elements.Element meaning, context, content model, global attributes, and end tag.ReviewedHTML Standard: the tr element
SPECrowIndex and sectionRowIndex use different rows collections.Distinguish the whole table, the parent row group, a table that is the direct parent, and a row outside a table.ReviewedHTML Standard: the tr element
SPECcells contains child td and th elements; insertCell() creates a td.Collection scope, insertion position, and index-range errors.ReviewedHTML Standard: the tr element
SPECThe parser inserts an implied tbody start tag before a tr written directly under table.Keep source markup distinct from the parsed DOM tree.ReviewedHTML Standard: restrictions on content models
AAMHTML-AAM maps tr to the row role.Keep the specification mapping separate from a browser Accessibility tree observation.Specification reviewedHTML-AAM: tr

Evidence

  1. HTML Standard: The tr element — meaning, context, content model, attributes, and row APIs
  2. HTML Standard: The table element — row groups and table child ordering
  3. HTML Standard: Restrictions on content models — implied tbody for a tr written under table
  4. HTML Accessibility API Mappings: tr — implicit row role and platform mappings
  5. Web Platform Tests: the-tr-element — row collections, indexes, and cell methods

Implementation Evidence

Specification requirements are kept separate from browser observations, WPT runs, and Accessibility role queries. Each result is limited to its recorded fixture, browser, and test selection.

Implementation evidence register for tr
TypeReproduced scopeRecorded conditionsStatus
IMPL HTMLTableRowElement, cells, rowIndex, sectionRowIndex, parser-implied tbody, and insertCell() / deleteCell() 2026-10-11 JST / Chrome UA 155.0.0.0 (Windows NT 10.0 UA) / viewport 1280×720 / navigator.language=ja. Served build-config/yugien/research-results/tr-v1/ at loopback 127.0.0.1:4196; fixture checks passed 14/14. Confirmed that cells includes only direct td/th children and excludes nested-table cells; rowIndex counts across the table while sectionRowIndex restarts in each row group; the parser inserts tbody before a directly written tr; detached row indexes are -1; and insert/delete operations plus out-of-range IndexSizeError. One browser environment only. OS build and other browsers were not measured. Partial observation (Chrome 155 / fixture 14/14)
WPT Selected WPTs for tr cell collections, cell insertion/deletion, rowIndex, and sectionRowIndex 2026-10-11 JST / Chrome UA 155.0.0.0 / wpt.live. cells.html: 1/1 passed; deleteCell.html: 6/6 passed; insertCell.html: 7/7 passed; rowIndex.html: 12/12 passed; sectionRowIndex.html: 19/19 passed. Total: 45/45 passed. The upstream revision served by wpt.live could not be identified, so wptRevision is unrecorded. Unselected WPTs and other browsers were not run.
Rerun (2026-10-11): Chrome 154.0.8037.98 / Windows build 26300. Ran 5 test files listed on this page: 45 checks passed, 0 failed, 0 timed out, and 0 did not run. Details: docs/atlas/wpt-results-2026-10-11.md. Other test files and browsers were not checked. This SHA applies only to the 2026-10-11 rerun; earlier WPT runs did not record their version.

WPT version used: ddb25fdfff7766af4cd75eac3fb3b6ac206140ce. Test-file links open files from this version.

Partial run (test version recorded)
AAM Native table, row group, row, column header, and data cell exposure through Chrome browser role queries 2026-10-11 JST / Chrome UA 155.0.0.0 (Windows NT 10.0 UA) / viewport 1280×720 / navigator.language=ja. Queried the fixture table named Fruit prices today and observed 1 table, 5 rows, 4 row groups, 2 column headers, 0 row headers, and 8 data cells. Row names were Fruit / Price, Apples / $1.20, Pears / $1.45, Oranges / $0.80, and Items / 3. This is a browser role-query observation; full HTML-AAM coverage, platform APIs such as Windows UIA, and screen-reader speech were not measured. Partial observation (Chrome 155 browser role queries / one environment)

A browser role/name query is not the same measurement as a platform Accessibility API or screen-reader speech. The observed layer and unmeasured scope stay separate.

Coverage / Open Issues

  • ReviewedElement meaning, context and content model, row groups, main HTMLTableRowElement members, and the HTML-AAM role mapping
  • OpenImplementation observations cover the selected fixture and one browser environment; all branches for multiple tables, section boundaries, and detached rows remain open
  • OpenWPTs outside the selected set, other browser engines, and results against a pinned WPT revision
  • OpenPlatform Accessibility APIs, Windows UI Automation, assistive-technology speech, other operating systems, and Expert-gap Review

This is initial coverage. Passing selected checks does not establish the same result for every HTML structure, browser, operating system, or assistive technology.

Related surfaces

For a beginner-friendly row example, see the Yugien tr page. For the section that groups body rows, see How to Use the tbody Element; for summary rows, see How to Use the tfoot Element. The full table model is covered by the table Topic; row-group rules and APIs by the tbody Topic and tfoot Topic; heading cells by th; data cells by td; and the table title by caption.