HTML / HTML Tags

HTML <Tr> Tag

Dec 12, 2022
2 min read
HTML tr Tag

Definition

A <tr> element represents a row of table cells.

Example

<table>
  <caption>This is the table's caption</caption>
    <thead>
        <tr>
            <th colspan="2">The table header with one column</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>The table body</td>
            <td>with two columns</td>
        </tr>
        <tr>
            <td>The table body</td>
            <td>with two rows</td>
        </tr>
    </tbody>
</table>

Usage

  • An opening tag is required.
  • A closing tag can be omitted if the <tr> element is immediately followed by another <tr> element or no more content in the parent element.
  • A <tr> element may be placed as a child of a <thead>, <tbody>, or <tfoot> element. It can also be placed as a child of a <table> element after any <caption>, <colgroup>, and <thead> elements, but only if there are no child <tbody> elements of the <table> element.
  • The <tr> element allows zero or more <td> and <th> elements as children.
  • You can use the colspan attribute on child <th> and <td> elements to specify how many columns a particular cell should span.
  • You can use the rowspan attribute on child <th> and <td> elements to specify how many rows the cell should span.

Attributes

The <tr> element only supports the Global Attributes.

Specification

Browser Support

Desktop

ChromeEdgeFirefoxIEOperaSafari
YesYesYesYesYesYes

Mobile

Android WebviewChrome AndroidFirefox AndroidOpera AndroidiOS SafariSamsung Internet
YesYesYesYesYesYes