<tr> (Table Row)
This element specifies a row in a table. The individual cells of the row are defined by the <th> and <td> elements.
Standard Syntax
<tr
align="center | justify | left | right"</tr>
bgcolor="color name | #RRGGBB" (transitional only)
char="character"
charoff="offset"
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
style="style information"
title="advisory text"
valign="baseline | bottom | middle | top"
td or th elements only
Attributes Defined by Internet Explorer
accesskey="key" (5.5)
bordercolor="color name | #RRGGBB" (4)
bordercolordark="color name | #RRGGBB" (4)
bordercolorlight="color name | #RRGGBB" (4)
hidefocus="true | false" (5.5)
language="javascript | javascript | vbs | vbscript" (4)
tabindex="number" (5.5)
valign="center" (4)
Standard Event Attributes
onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup
Events Defined by Internet Explorer
onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfilterchange, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror
Element Specific Attributes
- align
- This attribute is used to align the contents of the cells within the <tr> element. Common values are center, justify, left, and right.
- bgcolor
- This attribute specifies a background color for all the cells in a row. Its value can be either a named color, such as red, or a color specified in the hexadecimal #RRGGBB format, such as #FF0000.
- bordercolor
- This attribute, supported by Internet Explorer and Netscape, is used to set the border color for table cells in the row. The attribute should be used only with a positive value for the border attribute. The value of the attribute can be either a named color, such as green, or a color specified in the hexadecimal #RRGGBB format, such as #00FF00.
- bordercolordark
- This Internet Explorer-specific attribute specifies the darker of two border colors used to create a three-dimensional effect for the cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such as blue, or a color specified in the hexadecimal #RRGGBB format, such as #00FF00.
- bordercolorlight
- This Internet Explorer-specific attribute specifies the lighter of two border colors used to create a three-dimensional effect for a cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such as red, or a color specified in the hexadecimal #RRGGBB format, such as #FF0000.
- char
- This attribute is used to define the character to which element contents are aligned when the align attribute is set to the char value.
- charoff
- This attribute contains an offset as a positive or negative integer to align characters as related to the char value. A value of 2, for example, would align characters in a cell two characters to the right of the character defined by the char attribute.
- valign
- This attribute is used to set the vertical alignment for the table cells with the <tr> element. HTML 4.01 defines baseline, bottom, middle, and top. Internet Explorer replaces middle with center; the effect should be the same.
Example
<table width="300" border="1">
<tr bgcolor="red" align="center" valign="middle">
<td>3</td>
<td>5.6</td>
<td>7.9</td>
</tr>
</table>
Compatibility
HTML 3.2, 4, 4.01, XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1.1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7
Notes
This element is contained by the <table>, <thead>, <tbody>, and <tfoot> elements. It contains the <th> and <td> elements.
The HTML 3.2 specification defines only the align and valign attributes for this element.
Under the XHTML 1.0 specification, the closing </tr> tag ceases to be optional.