Denotes a table header cell.
HTML Syntax
<th
abbr = abbr_header
colspan = num_columns
headers = header_cells
rowspan = num_rows
scope =
>
A <th
> element’s end tag can be omitted if the <th
> element is immediately followed by a <td
> or <th
> element, or if there is no more content in the parent element.
The <th
> element specifies a table cell whose contents are used for column or row headings. <th
> elements can only be used inside table rows, or within a tr element.
Browsers usually display the content of <th
> elements centered within the cell, and in a bolder font than those of regular table cells.
Although the HTML Standard specifies that <th
> end tags are optional and may be omitted, it is safer to always close table headers, as not all browsers support this recommendation, and may produce unexpected results.
The <th>
element supports the following attributes, in addition to global attributes common to all HTML elements.
abbr | text | Specifies an abbreviated version of the content in a header cell |
colspan | number | Specifies the number of columns a header cell should span |
headers | header_id | Specifies one or more header cells a cell is related to |
rowspan | number | Specifies the number of rows a header cell should span |
scope | col, colgroup, row, rowgroup | Specifies whether a header cell is a header for a column, row, or group of columns or rows |
The following shows how the th element may be used.
<table>
<tr><th>This is the header row.</th></tr>
<tr><td>This is the first row.</td></tr>
<tr><td>This is the second row.</td></tr>
</table>
TABLE TBODY TD TFOOT THEAD TR Using Tables