HTML <tr> Tag
The HTML <tr> tag defines a row in an HTML table.Learn how to use HTML <tr> tag with syntax and examples with W3docs HTML tutorial.
The <tr> tag specifies a row in an HTML table. The cells inside it are defined using <th> (a header cell) or <td> (a standard cell) elements. Both the <td> and <th> tags support the colspan attribute for additional control over how cells span across or fit into columns. This attribute allows defining how many columns wide the cell must be (the default being 1). You can use the rowspan attribute on cells if you want to specify that they must span more than one row.
Some tables can also include the <col>, <colgroup>, <caption>, <tfoot>, <tbody>, and <thead> elements.
The <tr> element is declared inside the <table> tag.
Each row can contain a different number of cells. The browser renders exactly the cells specified in the markup; it does not automatically fill the row with empty cells. If you need to leave a cell empty, simply create a <td> or <th> element without content.
To customize the look of the table, use CSS properties.
Syntax
The <tr> tag comes in pairs. The content is written between the opening (<tr>) and closing (</tr>) tags.
Syntax of HTML <tr> Tag
<table>
<tr>
<td>...</td>
</tr>
</table>Example of the HTML <tr> tag:
Example of HTML <tr> Tag
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
table {
width: 80%;
margin: 30px auto;
border-collapse: collapse;
}
th,
td {
padding: 10px;
border: 1px solid #666;
}
</style>
</head>
<body>
<table>
<tr>
<th>Month</th>
<th>Date</th>
</tr>
<tr>
<td>March</td>
<td>10.09.2018</td>
</tr>
<tr>
<td>June</td>
<td>18.07.2018</td>
</tr>
</table>
</body>
</html>Result

Attributes
Note: The following attributes are deprecated in HTML5 and should not be used in modern web development.
| Attribute | Value | Description |
|---|---|---|
| align | right left center justify char | Aligns the content in a table row. Not supported in HTML 5. |
| bgcolor | bgcolor | Specifies a background color for a table row. Not supported in HTML 5. |
| bordercolor | bordercolor | Sets the color of the border. Not supported in HTML 5. |
| char | character | Aligns the content in a table row to a character. It is used only if the attribute is align="char". Not supported in HTML 5. |
| charoff | number | Sets the number of characters the content will be aligned from the character specified by the char attribute. It is used only if the attribute is align="char". Not supported in HTML 5. |
| valign | top middle bottom baseline | Specifies the vertical alignment of the content inside a table row. Not supported in HTML 5. |
The <tr> tag supports the Global Attributes and the Event Attributes.
How to style an HTML <tr> Tag
Practice
What is the purpose and usage of the <tr> tag in HTML?