HTML <tr> Tag

Description

The <tr> HTML element serves as a container for creating a table row. Each cell within such a row is set using the <th> or <td> element.

Properties

Permitted Parents
<table> (only if the table has no child <tbody> element, and even then only after any <caption>, <colgroup>, and <thead> elements); otherwise, the parent must be <thead>, <tbody> or <tfoot>
Content
<th>, <td>
Start/End Tags
Start tag: optional, End tag: optional

Example

<table border="1">
<tr>
<td>Cat</td>
<td>Dog</td>
</tr>
<tr>
<td>Mouse</td>
<td>Bird</td>
</tr>
</table>

Attributes

Attribute Definition
bgcolor Background color of the tr.

This attribute is not supported in HTML5, use CSS background-color property.

align Visual alignment.
Possible values:
  • left
  • center
  • right
  • justify
  • char

This attribute is not supported in HTML5.

valign Vertical alignment.
Possible values:
  • top
  • middle
  • bottom
  • baseline

This attribute is not supported in HTML5.

char Specifies a character to use for aligning text to. Used when align=char.

This attribute is not supported in HTML5.

charoff Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. Used when align=char

This attribute is not supported in HTML5.

Global Attributes

The <tr> tag also supports the Global Attributes in HTML5

Event Attributes

The <tr> tag also supports the Event Attributes in HTML5

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
YesYes11YesYes
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
YesYes4YesYesYes

Last updated by CSSPortal on: 6th December 2019