HTML tr Tag

HTML<tr>Tag: The HTML<tr> tag specifies a row in a HTML table. In HTML4 align, bgcolor, char, charoff, valign attributes are supported. And in HTML5 all the layout attributes are removed. These can be combine of <td> and <th> elements.

HTML<tr>Tag

This HTML tr tag supports both the global and the event attributes.

Syntax: <tr> Text</tr>

Browser compatibility

The HTML tr tag is supported by different types of browsers.

  • Chrome
  • Firefox
  • Opera
  • Safari
  • InternetExplorer

Example:

<!DOCTYPE html>
<html>
<head>
<style>
thead {color:green;}
tbody {color:blue;}
tfoot {color:red;}

table, th, td {
  border: 1px solid black;
}
</style>
</head>

<body>

<table>
  <thead>
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
<tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
  </thead>  
</table>
</body>
</html>

Output:

html tr tag

Attributes that are supported by the <tr> tag

Attribute Value Description
align right
left
center
justify
char
Aligns the content inside the

element

char character Aligns the content inside the

element to a character

charoff number Sets the number of characters the content inside the

element will be aligned from the character specified by the char attribute

valign top
middle
bottom
baseline
Vertical aligns the content inside the

element