HTML <tr>Tag
Examples
A simple HTML table with two columns and two rows:
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
Try it Yourself »
(See more examples at the bottom of the page)
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the <tr> tag.
Definition and Usage
The <tr> tag defines a row in an HTML table.
A <tr> element contains one or more<th>or<td>elements.
Differences between HTML 4.01 and HTML5
In HTML5, none of the attributes of the <tr> tag in HTML 4.01 are supported.
Attributes
| Attribute | Value | Description |
|---|---|---|
| align | right left center justify char |
Not supported in HTML5.Defines the alignment of the content within a table row. |
| bgcolor | rgb(x,x,x) #xxxxxx colorname |
Not supported in HTML5. Deprecated in HTML 4.01.Specifies the background color for a table row. |
| char | character | Not supported in HTML5.Specifies which character to use to align the text. |
| charoff | number | Not supported in HTML5.Specifies the offset of the first alignment character. |
| valign | top middle bottom baseline |
Not supported in HTML5.Specifies the vertical alignment of the content within a table row. |
Global Attributes
The <tr> tag supportsHTML Global Attributes.。
Event Attributes
The <tr> tag supportsHTML Event Attributes.。
Try it Yourself - Examples
This example demonstrates how to display table headers.
This example demonstrates how to use " " to handle cells with no content.
This example demonstrates a table with a caption.
This example demonstrates how to display elements inside other elements.
This example demonstrates how to define table cells that span rows or columns.
Related Articles
HTML Tutorial:HTML Tables
HTML DOM Reference:Tr Object
Other Extensions