HTML Dog
Skip to navigation

HTML Tag: th

Table header cell — the heading for a row or column.

th elements are children of tr elements.

Optional Attributes

Attribute Description Possible values
colspan Across how many columns the cell should spread (default is 1). Number.
rowspan Across how many rows the cell should spread (default is 1). Number.
headers Explicitly specifies which header cells, if any, are higher-lever headers to this cell. A single or comma-separated list of table cell id values.
scope Explicitly specifies which cells this cell is a header to.
  • row: Header applies to subsequent cells in the row.
  • col: Header applies to subsequent cells in the column.
  • rowgroup: Header applies to subsequent cells in the row group (defined by a tbody, thead, or tfoot element).
  • colgroup: Header applies to subsequent cells in the column group (defined by a colgroup element).
abbr An abbreviated version of the content of the cell. Used for quicker referencing, by assistive devices, for example. Text.
Global attributes

Example


<table>
    <tr>
        <th rowspan="2" scope="row">Carnivores</th>
        <td>Tiger</td>
        <td>Cheetah</td>
        <td>Caracal</td>
        <td>Wildcat</td>
    </tr>
    <tr>
        <td>Grey Wolf</td>
        <td>Cape hunting dog</td>
        <td>Red fox</td>
        <td>Fennec</td>
    </tr>
    <tr>
        <th scope="row">Primates</th>
        <td>Indri</td>
        <td>Sifaka</td>
        <td>Brown lemur</td>
        <td>Dwarf lemur</td>
    </tr>
</table>