| Depr. | Empty | Version |
|---|---|---|
| No | No | HTML 4 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ | CH2+ |
|---|---|---|---|---|
| Partial | Partial | Partial | Partial | Partial |
Syntax
Description
In a simple
table, the first row may contain table headers
(th elements), and that may be all you need to do to
mark up the table. However, you may find that wrapping a
thead around the header row—particularly if you have a
table that has multiple header rows at its top—gives you scope for more
control via the thead attributes; you might also make
use of this element as a “hook” from which to apply CSS styles to the
header area of your table. Another reason why specifying a table header in
this way revolves around printing—by indicating the
thead section, you can make it far easier for the
browser to repeat the header content of the table across numerous pages of
print-outs (where the browser provides an option to do this), otherwise
the browser may have to parse the table and make an educated guess as to
the what the table’s header cells are.
By default, a
thead will not affect the display of the table in any
way.
Example
The thead element
wraps around the row containing table headers (th
elements):
<table summary="Interest Rates">
<caption>Interest Rates</caption>
<thead>
<tr>
<th>Account Type</th>
<th>Interest Rate</th>
</tr>
</thead>
<tbody>
<tr>
<td>Smart</td>
<td>From 2%</td>
</tr>
<tr>
<td>Young Saver</td>
<td>From 1.6%</td>
</tr>
</tbody>
</table>
Use This For …
This element is used for grouping the top layer(s) of header cells.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 3.0 | 3.5 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial | Partial |
By itself—without the
application of any of the element-specific attributes detailed below—the
presence of a thead makes no visual difference to the
table. For a true indication of this element’s
compatibility, you should refer to each individual attribute to see what
works and what fails.
In this Section
- align
aligns text in table cells contained inside thead element - char
sets the character to which header element contents should align - charoff
defines the number of characters by which cell contents will be offset from the char - valign
aligns the text vertically in table cells contained within the thead element