Description:

The <th> tag is used for specifying a header cell (or table header) within a table. This tag is also used with the <table> element and <tr> element.

Example Code:
<table border="1">
  <tr>
    <th>Animal</th>
    <th>Color</th>
  </tr>
  <tr>
    <td>Mouse</td>
    <td>White</td>
  </tr>
</table>
Result:
Animal Color
Mouse White
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



Last updated on 2 August 2018 By Rene Spronk

View All HTML Tags

Errors? Please help to keep this list up to date, If you find any errors, please contact us, so that we can get them fixed.