37
Inheritance of alignment specifications
The alignment of cell contents can be specified on a cell by cell basis, or inherited from enclosing
elements, such as the row, column or the table itself.
The order of precedence (from highest to lowest) for the attributes align, char, and charoff is the
following:
1. An alignment attribute set on an element within a cell's data (e.g., P).
2. An alignment attribute set on a cell (TH and TD).
3. An alignment attribute set on a column grouping element (COL and COLGROUP). When a cell is part
of a multi-column span, the alignment property is inherited from the cell definition at the beginning
of the span.
4. An alignment attribute set on a row or row grouping element (TR, THEAD, TFOOT, and TBODY).
When a cell is part of a multi-row span, the alignment property is inherited from the cell definition at
the beginning of the span.
5. An alignment attribute set on the table (TABLE).
6. The default alignment value.
The order of precedence (from highest to lowest) for the attribute valign (as well as the other inherited
attributes lang, dir, and style) is the following:
1. An attribute set on an element within a cell's data (e.g., P).
2. An attribute set on a cell (TH and TD).
3. An attribute set on a row or row grouping element (TR, THEAD, TFOOT, and TBODY). When a cell is
part of a multi-row span, the attribute value is inherited from the cell definition at the beginning of
the span.
4. An attribute set on a column grouping element (COL and COLGROUP). When a cell is part of a
multi-column span, the attribute value is inherited from the cell definition at the beginning of the
span.
5. An attribute set on the table (TABLE).
6. The default attribute value.
Furthermore, when rendering cells, horizontal alignment is determined by columns in preference to rows,
while for vertical alignment, rows are given preference over columns.
The default alignment for cells depends on the user agent. However, user agents should substitute the
default attribute for the current directionality (i.e., not just "left" in all cases).
User agents that do not support the "justify" value of the align attribute should use the value of the
inherited directionality in its place.
Note. Note that a cell may inherit an attribute not from its parent but from the first cell in a span. This is
an exception to the general attribute inheritance rules.
123
11.3.2 Horizontal and vertical alignment