In terms of markup and table structure, headers are placed in
the tr element, the same as a
td, as shown in this
example.
<table>
<tr><th>Planet</th><th>Distance from Earth</th></tr>
<tr><td>Venus</td><td>pretty darn far</td></tr>
<tr><td>Neptune</td><td>ridiculously far</td></tr>
</table>User agents usually render the contents of table headers slightly differently than regular table cells (most often in bold, centered text); however, their appearance may easily be changed with style sheets.
The difference between th
and td elements is not merely
presentational, however. Table headers perform an important function
in binding descriptive labels to table cells for non-visual
browsers. They are discussed in more detail in the "Accessible Tables" section
later in this chapter. Table header elements should not be used in
layout tables.