asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > HTML Elements > TH Element

<TH Element | TH Object


Denotes a table header cell.

HTML Syntax

Remarks

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 W3C 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.

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.

Attributes

The <th> element supports the following attributes, in addition to global attributes common to all HTML elements.

AttributeValueDescription
abbrtextSpecifies an abbreviated version of the content in a header cell
colspannumberSpecifies the number of columns a header cell should span
headersheader_idSpecifies one or more header cells a cell is related to
rowspannumberSpecifies the number of rows a header cell should span
scopecol, colgroup, row, rowgroupSpecifies whether a header cell is a header for a column, row, or group of columns or rows

Example

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>

External References

See Also

TABLE, TD, TR, Using Tables


Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note