thead (HTML element)
| Depr. | Empty | Version |
|---|---|---|
| No | No | HTML 4 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ |
|---|---|---|---|
| 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.
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 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 1.0 | 1.5 | 2.0 | 1.3 | 2.0 | 3.0 | 9.2 | 9.5 |
| 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 insidetheadelementchar
sets the character to which header element contents should aligncharoff
defines the number of characters by which cell contents will be offset from thecharvalign
aligns the text vertically in table cells contained within thetheadelement
User-contributed notes
- ID:
- #1
- Date:
- Fri, 28 Mar 2008 13:30:39 GMT
A user agent may also choose to render the table header on each page when printing a large table.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.