Code has been added to clipboard!

HTML thead Tag

Reading time 2 min
Published Jun 29, 2017
Updated Sep 11, 2019

HTML thead: Main Tips

  • In an HTML table, the thead tag is used to group header content.
  • HTML thead tag goes inside the <table> element and has <tr> elements nested inside.
  • The thead HTML element is used together with <tbody> and <tfoot> to define parts of a table.

Creating HTML Table Headers

The thead tag is used to define the top table row that contains the heads of the columns. In other words, it allows you to create HTML table headers:

Example
<table border>
 <thead>
  <tr>
    <td>Purchase</td>
    <td>Price</td>
  </tr>
 </thead>
</table>

You can only skip the ending tag if a <tbody> or <tfoot> follows your HTML thead element immediately.

Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid certificates of completion
Udemy
Pros
  • Easy to navigate
  • No technical issues
  • Seems to care about its users
Main Features
  • Huge variety of courses
  • 30-day refund policy
  • Free certificates of completion
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

Removed thead Tag Attributes

HTML thead tag used to have a few tag-specific attributes. However, all of them have been deprecated in HTML4 and removed completely in HTML5. You can use CSS properties to achieve similar results.

align defined the alignment of content for the <thead> element:

Example
<thead align="left">

Note: instead of align, use the CSS text-align property.

char set the alignment of content inside the <thead> according to the character specified:

Example
<thead align="char" char="M">

charoff set the number of characters for aligning the content after the character specified by the char attribute:

Example
<thead align="char" char="S" charoff="3">

valign set all the content inside the <thead> element to align vertically:

Example
<thead valign="bottom">

Note: instead of valign, use the CSS vertical-align property.

Browser Support

Browser image
Chrome
1+
Browser image
Edge
All
Browser image
Firefox
1+
Browser image
IE
All
Browser image
Opera
All
Browser image
Safari
All

Mobile Browser Support

Browser image
Chrome
All
Browser image
Firefox
4+
Browser image
Opera
All
Browser image
Safari
All