[thelist] <thead> vs. <th>?

Marc Seyon seyon at delime.com
Mon Apr 8 21:27:01 CDT 2002


Message from Mike Combs (4/8/2002 09:10 PM)
>I'm trying to be a good citizen, but I just don't see the difference here.
>
>When should I use
>
><thead>
>   <td>col1</td>
>   <td>col2>/td>
></thead>
>
>And when should I use
><tr>
>   <td>col1</td>
>   <td>col2</td>
></tr>

Hi Mike,

That's not precisely how you use it. Rather, you use <thead> to encapsulate
an entire row (or rows) to designate them as the Table Header.

Here's how it could look in a simple example.
<table>
<thead>
<tr>
<td>Name</td>
<td>Colour</td>
</tr>
</thead>
<tr>
<td>Me</td>
<td>Blue</td>
</tr>
<tr>
<td>You</td>
<td>Red</td>
</tr>
</table>

According to the spec, "This division enables user agents to support
scrolling of table bodies independently of the table head and foot. When
long tables are printed, the table head and foot information may be
repeated on each page that contains table data."

http://www.w3.org/TR/html4/struct/tables.html#h-11.2.3

TH, on the other hand, is used to style a specific cell as a header cell
rather than an ordinary data cell.

hope that helps.
-marc



More information about the thelist mailing list