HTML <th> Tag

Topic: HTML5 Tags Reference« Prev|Next »


The <th> tag defines a header cell in a table. A Table cells may contain two types of information: header information and data.

  • The <th> (short for table head) tag defines a cell that contains header information.
  • The <td> tag defines a cell that contains data.

This distinction enables web browser to render header and data cells distinctly, even in the absence of style sheets. For example, header cell text rendered with a bold font while text inside the data cell rendered as a regular text.

The following table summarizes the usages context and the version history of this tag.

Parent: <tr>
Content: Block, inline, and text
Start/End Tag: Start tag: required, End tag: optional
Version: HTML 3.2, 4, 4.01, 5


The basic syntax of the <th> tag is given with:

HTML / XHTML: <th> ... </th>

The example below shows the <th> tag in action.

  • <table>
  •     <tr>
  •         <th>No.</th>
  •         <th>Name</th>
  •         <th>Email</th>
  •     </tr>
  •     <tr>
  •         <td>1</td>
  •         <td>John Carter</td>
  •         <td></td>
  •     </tr>
  •     <tr>
  •         <td>2</td>
  •         <td>Peter Parker</td>
  •         <td></td>
  •     </tr>
  •     <tr>
  •         <td>3</td>
  •         <td>John Rambo</td>
  •         <td></td>
  •     </tr>
  • </table>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <th> tag.

Attribute Value Description
abbr text Provide a short abbreviated description of the cell's content.
align left
Obsolete Specifies the alignment of cell contents.
axis text Obsolete Categorized a group of related headers.
bgcolor color Obsolete Sets the background color of a header cell.
char character Obsolete Sets the character to which cell contents should align.
charoff number Obsolete Defines the number of characters by which cell contents will be offset from the alignment characters specified by the char attribute.
colspan number Specifies the number of columns spanned by the current cell.
headers header-id Specifies one or more header cells a cell is related to.
height length Obsolete Sets the height of the header cell.
nowrap nowrap Obsolete This boolean attribute tells the browser to disable automatic text wrapping for this cell.
rowspan number Specifies the number of rows spanned by the current cell.
scope col
Specifies the set of data cells for which the current header cell provides header information.
sorted reversed
Specifies the sort direction of a column.
valign top
Obsolete Specifies the vertical alignment of content within a header cell.
width length Obsolete Sets the width of a header cell.

Global Attributes

Like all other HTML tags, the <th> tag supports the global attributes in HTML5.

Event Attributes

The <th> tag also supports the event attributes in HTML5.

Browser Compatibility

The <th> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: HTML Tables.

Other table-related tags: <table>, <thead>, <tfoot>, <tbody>, <caption>, <colgroup>, <col>, <tr>, <td>.


Your Feedback:


We would love to hear from you! Please say something.