HTML <th> tag

Usage

Table header. Works in the same way as a normal table cell (td), but displays differently to signify its header status.

Example

Code:

<table border="1">
<tr>
<th>Year</th>
<th>Sales</th>
</tr>
<tr>
<td>2006</td>
<td>18,956</td>
</tr>
</table>

Output:

Year Sales
2006 18,956

Required Attributes

  • none

Optional Attributes

  • abbr - defines an abbreviated version of the cell data
  • align - left, right, center, justify, char - the horizontal alignment of the cell data
  • axis - specifies a name for the cell
  • char - specifies the character that the text should be aligned around; not supported by many browsers
  • charoff - the number of pixels to offset the alignment by; again not supported by many browsers
  • colspan - the number of columns that the cell should span, used for merging cells
  • rowspan - the number of rows that the cell should span, used for merging cells
  • headers - a space separated lists of cell id's for the use of text-only browsers
  • scope - row, col, rowgroup, colgroup - tells the browser if the cell provides header information for the rest of the row, column, rowgroup or colgroup
  • valign - vertical alignment of the text

Core Attributes