HTML <th> Tag

Description

The <th> HTML element is designed to create one table cell, which is designated as the header. The text in such a cell is usually displayed in bold by the browser and is aligned in the center. The <th> element must be placed inside the <tr> container, which in turn is located inside the <table>.

Properties

Permitted Parents
A <tr> element
Content
Block, inline and text
Start/End Tags
Start tag: optional, End tag: optional

Example

<table border="1">
<tr>
<th>Animal</th>
<th>Color</th>
</tr>
<tr>
<td>Mouse</td>
<td>White</td>
</tr>
</table>

Attributes

Attribute Definition
scope Defines a way to associate header cells and data cells in a table
abbr Specifies an abbreviated version of the content in a cell
axis Categorizes cells
rowspan Sets the number of rows a cell should span
colspan Specifies the number of columns a cell should span
nowrap Specifies that the content inside a cell should not wrap
width Specifies the width of a cell
height Sets the height of a cell
bgcolor Background color of the td.
align Visual alignment.
Possible values:
  • left
  • center
  • right
  • justify
  • char
valign Vertical alignment.
Possible values:
  • top
  • middle
  • bottom
  • baseline
char Specifies a character to use for aligning text to. Used when align=char.
charoff Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. Used when align=char

Global Attributes

The <th> tag also supports the Global Attributes in HTML5

Event Attributes

The <th> tag also supports the Event Attributes in HTML5

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
YesYes11YesYes
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
YesYes4YesYesYes

Last updated by CSSPortal on: 6th December 2019