asp.net.ph

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

<th> Element


Denotes a table header cell.

HTML Syntax

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.

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

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   TBODY   TD   TFOOT   THEAD   TR   Using Tables


Need a break ?
Suggested Reading

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