# TR - Table Row

Syntax | <TR>...</TR>
Attribute Specifications | ALIGN=[ left | center | right | justify | char ] (horizontal alignment of cells in group) CHAR=Character (alignment character for cells) CHAROFF=Length (alignment character offset) VALIGN=[ top | middle | bottom | baseline ] (vertical alignment of cells in group) BGCOLOR=Color (row background color) common attributes
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:

- top, which positions data at the top of the cell;
- middle, the default value, which centers the cell data vertically;
- bottom, which positions data at the bottom of the cell;
- baseline, which specifies that the first line of each cell in the row with ALIGN=baseline should occur on a common baseline.

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.

## More Information

- TR in W3C HTML 4.0 Recommendation
- TR in W3C HTML 3.2 Recommendation
- TR in WDG HTML 3.2 Reference
- TR in Learning HTML 3.2 by Examples