Table Rows
Permitted Context: TABLE
Content Model: Table Cells
(TH or TD)
The TR element acts as a container for a row of table cells defined
with the TH or TD elements. You can set default horizontal and vertical
alignment of cell contents for the row. You also have the ability to
disable word wrap for the row, and thereafter use the <BR> element
to determine line breaks and hence cell widths.
To assist with formatting tables to paged media, authors can
differentiate leading and trailing rows that are to be duplicated when
splitting tables across page boundaries. The recommended approach is to
subclass rows using the CLASS attribute For example:
<TABLE BORDER COLSPEC= ...>
<TR CLASS=Header> header cells ...
<TR CLASS=Body> body cells ...
<TR CLASS=Footer> footer cells ...
</TABLE>
Paged browsers when splitting a table across a page boundary, can then
insert footer rows at the bottom of the current page and header rows at
the top of the next page, followed by the remaining body rows, and the
footer rows. This is repeated as necessary until all of the body rows
have been rendered. Refinements of this scheme can be devised by further
subclassing the rows together with an appropriate style sheet.
Permitted Attributes for the TR Element
- ID
- An SGML identifier used as the target for hypertext
links or for naming particular elements in associated style sheets.
Identifiers are NAME tokens and must be unique within the scope of
the current document.
- LANG
- This is one of the ISO standard language abbreviations,
e.g. "en.uk" for the variation of English spoken in the United Kingdom.
It can be used by parsers to select language specific choices for
quotation marks, ligatures and hypenation rules etc. The language
attribute is composed from the two letter language code from ISO 639,
optionally followed by a period and a two letter country code from ISO
3166.
- CLASS
- This a space separated list of SGML NAME tokens and is
used to subclass tag names. By convention, the class names are
interpreted hierarchically, with the most general class on the left
and the most specific on the right, where classes are separated by a
period. The CLASS attribute is most commonly used to attach a
different style to some element, but it is recommended that where
practical class names should be picked on the basis of the element's
semantics, as this will permit other uses, such as restricting search
through documents by matching on element class names. The conventions
for choosing class names are outside the scope of this specification.
- ALIGN
- The ALIGN attribute can be used to explicitly specify
the horizontal alignment of paragraphs within a table row:
- align=left
- Paragraphs are rendered flush left.
- align=center
- Paragraphs are centered.
- align=right
- Paragraphs are rendered flush right.
- align=justify
- Text lines are justified where practical,
otherwise this gives the same effect as the align=left setting.
- align=decimal
- Text lines are indented such that the first
occurrence of a decimal point on each line are aligned vertically. If a
line doesn't contain a decimal point, the line is rendered flush left
for data cells and centered for header cells.
Note: By default, header cells are centered while data cells
are flush left. This attribute can be used to alter these defaults on a row
by row basis. If you are specifying column alignments with the TABLE's
COLSPEC attribute, there is no point in also including an ALIGN attribute
with the TR element, as the latter will be ignored.
- DP
- This specifies the character to be used for the decimal
point with the ALIGN attribute, e.g. dp="." (the default) or dp=",".
The default may be altered by the language context, as set by the LANG
attribute on enclosing elements.
- VALIGN
- The VALIGN attribute can be used to explicitly specify
the vertical alignment of material within a table row. It is overridden
by the VALIGN attribute on individual cells:
- valign=top
- The cell contents appear at the top of each cell
(the default).
- valign=middle
- Cell contents are centered vertically in each cell.
- valign=bottom
- The cell contents appear at the bottom of each
cell.
- valign=baseline
- This is used when you want to ensure that all
cells in the row share the same baseline. This constraint only applies
to the first text line for each cell.
- NOWRAP
- The NOWRAP attribute is used when you don't want the
browser to automatically wrap lines. You can then explicitly specify
line breaks in paragrphs using the BR element.