W3Schools.com

HTML5 <th> Tag

Example

A simple HTML table with two header cells and two data cells:

<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

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


Definition and Usage

The <th> tag defines a header cell in an HTML table.

An HTML table has two kinds of cells:

  • Header cells - contains header information (created with the <th> element)
  • Standard cells - contains data (created with the <td> element)

The text in <th> elements are bold and centered by default.

The text in <td> elements are regular and left-aligned by default.


Differences Between HTML 4.01 and HTML5

Some HTML 4.01 attributes are not supported in HTML5.


Attributes

Attribute Value Description
abbr text Not supported in HTML5
align left
right
center
justify
char
Not supported in HTML5
axis category_name Not supported in HTML5
char character Not supported in HTML5
charoff number Not supported in HTML5
colspan number Specifies the number of columns a header cell should span
headers header_id Specifies one or more header cells a cell is related to
height pixels
%
Not supported in HTML5
nowrap nowrap Not supported in HTML5
rowspan number Specifies the number of rows a header cell should span
scope col
colgroup
row
rowgroup
Specifies whether a header cell is a header for a column, row, or group of columns or rows
valign top
middle
bottom
baseline
Not supported in HTML5
width pixels
%
Not supported in HTML5

Global Attributes

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


Event Attributes

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


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE