|Contents||One or more TH or TD elements|
|Contained in||THEAD, TFOOT, TBODY|
The TR element defines a table row. TR elements must be contained within a row group defined by THEAD, TFOOT, or TBODY. Since the start and end tags of TBODY are optional when the table has one TBODY and no THEAD or TFOOT, the simple table structure of HTML†3.2 is still valid:
<TABLE> <TR> <TH>Abbreviation</TH> <TH>Long Form</TH> </TR> <TR> <TD>AFAIK</TD> <TD>As Far As I Know</TD> </TR> </TABLE>
TR contains TH or TD elements, which in turn contain the actual data of the table. In addition to the attributes common to most elements, TR takes presentational attributes for specifying the alignment of cells within the row and the row's background color.
The ALIGN attribute specifies the horizontal alignment for each cell in the row. Possible values are left, center, right, justify, and char. ALIGN=char aligns a cell's contents on the character given in the CHAR attribute. The default value for the CHAR attribute is the decimal point of the current language--a period in English. The CHAROFF attribute specifies the offset to the first occurrence of the alignment character. The attribute's value is a number in pixels or a percentage of the cell's width; CHAROFF="50%" centers the alignment character horizontally in a cell.
The VALIGN attribute specifies the vertical position of a cell's contents. Possible values are:
The deprecated BGCOLOR attribute suggests a background color for the row. The combination of this attribute with <FONT COLOR=...> can leave invisible or unreadable text on Netscape Navigator 2.x, which does not support BGCOLOR on table elements. BGCOLOR is dangerous even on supporting browsers, since most fail to override it when overriding other author-specified colors. Style sheets provide a safer, more flexible method of specifying a row's background color.