content logo

Learn HTML:

Html tr tag

The HTML <tr> tag is used for specifying a table row within a table.

Example

<!DOCTYPE html>
<html>
<head>
<title>HTML tr Tag</title>
</head>
<body>
<table border="1">
  <tr>
    <th>Cricketers</th>
    <th>Ranking</th>
  </tr>
  <tr>
    <td>M.S Dhoni</td>
    <td>1</td>
  </tr>
  <tr>
    <td>Yuvraj Singh</td>
    <td>2</td>
  </tr>
  <tr>
    <td>Virat Kohli</td>
    <td>3</td>
  </tr>
</table>
</body>
</html>

This will produce following result:

Cricketers Ranking
M.S Dhoni 1
Yuvraj Singh 2
Virat Kohli 3

 

Specific Attributes

The HTML <tr> tag also supports following additional attributes:

Attribute Value Description
align right
left
center
justify
char
Deprecated-Visual alignment.
bgcolor rgb(x,x,x)
#hexcode
colorname
Deprecated-Specifies the background color of the table cell.
char character Deprecated-Specifies which character to align text on. Used when align="char".
charoff pixels or % Deprecated-Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. Used when align="char".
valign top
middle
bottom
baseline
Deprecated-Vertical alignment.
#

HTML Tr Example

#

HTML Tr Code

#

HTML Tr Tutorial