HTML <tr> Tag

Advertisements


Description

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

Global Attributes

This tag supports all the global attributes described in - HTML Attribute Reference

Specific Attributes

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

AttributeValueDescription
alignright
left
center
justify
char
Deprecated-Visual alignment.
bgcolorrgb(x,x,x)
#hexcode
colorname
Deprecated-Specifies the background color of the table cell.
charcharacterDeprecated-Specifies which character to align text on. Used when align="char".
charoffpixels 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".
valigntop
middle
bottom
baseline
Deprecated-Vertical alignment.

Event Attributes

This tag supports all the event attributes described in - HTML Events Reference

Browser Support

ChromeFirefoxIEOperaSafariAndroid
YesYesYesYesYesYes

html_tags_reference.htm