4.11. Table Cells: TH and TD
Connected: An Internet Encyclopedia
4.11. Table Cells: TH and TD
Up:
Connected: An Internet Encyclopedia
Up:
Requests For Comments
Up:
RFC 1942
Up:
4. A walk through the Table DTD
Prev: 4.10. Table Row (TR) elements
Next: 5. Recommended Layout Algorithms
4.11. Table Cells: TH and TD
4.11. Table Cells: TH and TD
<!ELEMENT (th|td) - O %body.content>
<!ATTLIST (th|td) -- header or data cell --
%attrs; -- id, lang, dir and class --
axis CDATA #IMPLIED -- defaults to cell content --
axes CDATA #IMPLIED -- list of axis names --
nowrap (nowrap) #IMPLIED -- suppress word wrap --
rowspan NUMBER 1 -- number of rows spanned by --
-- cell --
colspan NUMBER 1 -- number of cols spanned by --
-- cell --
%cell.halign; -- horizontal alignment in --
-- cells --
%cell.valign; -- vertical alignment in cells --
>
TH elements are used to represent header cells, while TD elements
are used to represent data cells. This allows user agents to render
header and data cells distinctly, even in the absence of style
sheets.
Cells can span multiple rows and columns, and may be empty. Cells
spanning rows contribute to the column count on each of the spanned
rows, but only appear in the markup once (in the first row spanned).
The row count is determined by the number of TR elements. Any rows
implied by cells spanning rows beyond this should be ignored.
If the column count for the table is greater than the number of
cells for a given row (after including cells for spanned rows), the
missing cells are treated as occurring on the right hand side of the
table and rendered as empty cells. If the language context indicates
a right to left writing order, then the missing cells should be
placed on the left hand side.
It is possible to create tables with overlapping cells, for
instance:
<table border>
<tr><td rowspan=2>1<td>2<td>3
<tr><td rowspan=2>4
<tr><td colspan=2>5<td>6
</table>
which might look something like:
/-----------\
| 1 | 2 | 3 |
| |-------|
| | 4 | |
|---|...|---|
| 5 : | 6 |
\-----------/
In this example, the cells labelled 4 and 5 overlap. In such cases,
the rendering is implementation dependent.
The AXIS and AXES attributes for cells provide a means for defining
concise labels for cells. When rendering to speech, these attributes
may be used to provide abbreviated names for the headers relevant to
each cell. Another application is when you want to be able to later
process table contents to enter them into a database. These
attributes are then used to give database field names. The table's
class attribute should be used to let the software recognize which
tables can be treated in this way.
- ID, CLASS, LANG and DIR
-
See earlier description of common attributes.
- AXIS
-
This defines an abbreviated name for a header cell, e.g. which
can be used when rendering to speech. It defaults to the cell's
content.
- AXES
-
This is a comma separated list of axis names which together
identify the row and column headers that pertain to this cell.
It is used for example when rendering to speech to identify the
cell's position in the table. If missing the user agent can try
to follow up columns and left along rows (right for some
languages) to find the corresponding header cells.
- NOWRAP, e.g. <TD NOWRAP>
-
The presence of this attribute disables automatic wrapping of
text lines for this cell. If used uncautiously, it may result in
excessively wide cells. This attribute is defined for backwards
compatibility with deployed user agents. Greater control is
possible with associated style sheet languages (for example for
control over overflow handling).
- ROWSPAN, e.g. <TD ROWSPAN=2>
-
A positive integer value that defines how may rows this cell
spans. The default ROWSPAN is 1. ROWSPAN=0 has a special
significance and implies that the cell spans all rows from the
current row up to the last row of the table.
- COLSPAN, e.g. <TD COLSPAN=2>
-
A positive integer value that defines how may columns this cell
spans. The default COLSPAN is 1. COLSPAN=0 has a special
significance and implies that the cell spans all columns from
the current column up to the last column of the table.
- ALIGN, CHAR, CHAROFF and VALIGN
-
Specify values for horizontal and vertical alignment within
table cells. See inheritance order of alignment properties.
Note: It is recommended that implementors provide support for the
Netscape 1.1 WIDTH attribute for TH and TD, although this isn't part
of the current specification. Document authors are advised to use
the width attribute for the COL element instead.
Next: 5. Recommended Layout Algorithms
Connected: An Internet Encyclopedia
4.11. Table Cells: TH and TD
|