HTML and CSS Reference
In-Depth Information
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 can 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.0 specification,
and support for this attribute is still minimal in browsers.
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.
Example
<table border="1">
<tr>
<th>
Names
</th>
<th>
Apples
</th>
<th>
Oranges
</th>
</tr>
<tr>
<td>
Rusty
</td>
<td>
10
</td>
<td>
5
</td>
</tr>
<tr>
<td>
Ruby Sue
</td>
<td>
20
</td>
<td>
3
</td>
</tr>
</table>
Compatibility
HTML 3.2, 4, 4.01, 5
XHTML 1.0, 1.1, Basic
Firefox 1+, Internet Explorer 2+,
Netscape 1.1+, Opera 4+, Safari 1+
Notes
• The HTML 3.2 specification defines only
align
,
colspan
,
height
,
nowrap
,
rowspan
,
valign
, and
width
attributes.
• This element should always be within the
tr
element.
• Under the XHTML 1.0 specification, the closing
</th>
tag ceases to be optional.
<thead> (Table Header)
This element is used to group the rows within the header of a table so that common alignment
and style defaults can easily be set for numerous cells. This element might be particularly
useful when setting a common head for tables that are dynamically generated.