The
<tr>tag in HTML defines a table row.
It is used inside the<table>element to group one or more table cells (<th>or<td>) in a single horizontal row.
Syntax
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>Attributes
| Attribute | Description |
|---|---|
align | Specifies the horizontal alignment of content in a row (deprecated). |
bgcolor | Specifies the background color of a row (deprecated). |
valign | Specifies the vertical alignment of content in a row (deprecated). |
⚠️ These attributes are deprecated. Use CSS instead for layout and styling.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML tr Tag Example</title>
</head>
<body>
<h2>Example of the <tr> Tag</h2>
<table border="1">
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$150</td>
</tr>
</table>
</body>
</html>Output
Browser Output
Use our TryIt Editor to see the output
Browser Support
Chrome | Firefox | Edge | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| ✅Yes | ✅Yes | ✅Yes | ✅Yes | ✅Yes | ✅Yes |
All modern browser support <tr> html tag
Notes
- A
<tr>must be placed inside a<table>,<thead>,<tbody>, or<tfoot>element. - Each
<tr>represents one row of table cells. - It can contain both
<th>(header cells) and<td>(data cells).
Conclusion
- The
<tr>tag represents a single row in a table. - It is used within
<table>,<thead>,<tbody>, or<tfoot>elements. - Each row contains one or more
<th>or<td>cells.
In simple terms, the <tr> tag helps organize your table data horizontally — each <tr> creates one complete row of information, making your table more structured and readable.