HTML <tr> tag
Go Deeper
HTML <tr> Tag
Example
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>
(More examples at the bottom of the page)
Browser Support
All major browsers support the <tr> tag.
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 supported in HTML 4.01 are supported for the <tr> tag.
Attributes
| Attribute | Value | Description |
|---|---|---|
| align | right left center justify char |
Not supported in HTML5. Specifies the horizontal alignment of the content in a table row. |
| bgcolor | rgb(x,x,x) #xxxxxx colorname |
Not supported in HTML5. Deprecated in HTML 4.01. Specifies the background color of a table row. |
| char | character | Not supported in HTML5. Specifies which character to align the content to. |
| charoff | number | Not supported in HTML5. Specifies the offset from the first alignment character. |
| valign | top middle bottom baseline |
Not supported in HTML5. Specifies the vertical alignment of the content in a table row. |
Global Attributes
The <tr> tag supports the Global Attributes in HTML.
Event Attributes
The <tr> tag supports the Event Attributes in HTML.
Try it Yourself - Examples
Table Headers
This example demonstrates how to display table headers.
Empty Cells
This example demonstrates how to use " " to handle cells with no content.
Tables with Captions
This example demonstrates a table with a caption.
Tags Inside a Table
This example demonstrates how to display elements inside other elements.
Table Cells that Span Many Rows/Columns
This example demonstrates how to define table cells that span more than one row or column.
Related Articles
HTML Tutorial: HTML Tables
HTML DOM Reference: The Tr Object
YouTip