HTML and CSS Reference
In-Depth Information
colspan
This attribute takes a numeric value that indicates how many columns wide a cell
should be. This is useful for creating tables with cells of different widths.
headers
This attribute takes a space-separated list of
id
values that correspond to the
header cells related to this cell.
height
This attribute indicates the height of the cell, in pixels or as a percentage. Some
browsers may have rendering problems with percentage values.
nowrap
This attribute keeps the content within a table cell from automatically wrapping.
The
nowrap
attribute takes no value under HTML but should be set to the value
nowrap
under XHTML.
rowspan
This attribute takes a numeric value that indicates how many rows high a table
cell should span. This attribute is useful in defining tables with cells of different heights.
scope
This attribute specifies the table cells for which the current cell provides header
information. A value of
col
indicates that the cell is a header for the rest of the column
below it. A value of
colgroup
indicates that the cell is a header for its current column
group. A value of
row
indicates that the cell contains header information for the rest of the
row it is in. A value of
rowgroup
indicates that the cell is a header for its row group. This
attribute might be used in place of the
header
attribute and is useful for rendering
assistance by nonvisual browsers. This attribute was added very late to the HTML 4
specification, and support for this attribute is still minimal.
valign
This attribute is used to set the vertical alignment for the table cell. The specification
defines
baseline
,
bottom
,
middle
, and
top
. Internet Explorer also supports
center
,
which should be the same as
middle
.
width
This attribute specifies the width of a cell, in pixels or as a percentage value.
Examples
<table>
<tr>
<td align="left" valign="top" width="100">
Put me in the top left corner.
</td>
<td align="right" bgcolor="red" valign="bottom" width="100">
Put me in the bottom right corner.
</td>
</tr>
</table>
<table border="1" width="80%">
<tr>
<td colspan="3">
A pretty wide cell
</td>
<tr>
<td>
Item 2
</td>