HTML <tr> Element

The <tr> element defines a row of cells within an HTML table. A table row contains one or more <th> header cells, <td> data cells, or a combination of both.

Syntax

<tr>
  <td>Notebook</td>
  <td>$4.95</td>
</tr>

Attributes

The <tr> element supports the global HTML attributes. It does not have any element-specific attributes.

Example

This example uses <tr> elements to create a header row and two rows of product data within an HTML table.

Play in Editor

Usage Notes

The <tr> element represents a single row in a table and contains the cells that belong to that row. Use <th> for header cells and <td> for ordinary data cells.

Table rows can be grouped inside <thead>, <tbody>, and <tfoot> elements to identify the header, body, and footer sections of a table.

Rows should use a consistent cell structure when possible so the relationship between columns and their data remains clear. Cells can span multiple rows or columns when a more complex table structure is required.

Accessibility

The <tr> element provides structural organization for table cells, but accessible tables also depend on correctly identifying header cells with <th>. Use appropriate header relationships so assistive technologies can associate each data cell with the headings that describe it.

Browser Support

Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.

For detailed browser compatibility information, see Can I Use: HTML <tr> Element .

The <tr> element is used with other table elements, including <table>, <thead>, <tbody>, <tfoot>, <th>, and <td>.

Specifications

The <tr> element is defined in the WHATWG HTML Living Standard .