HTML <thead>Tag


Examples

An HTML table with <thead>, <tfoot>, and <tbody> elements:

<table border="1"> <thead> <tr> <th>Month</th> <th>Savings</th> </tr> </thead> <tfoot> <tr> <td>Sum</td> <td>$180</td> </tr> </tfoot> <tbody> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </tbody> </table>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the <thead> tag.


Definition and Usage

The <thead> tag is used to group the header content of an HTML table.

The <thead> element should be used with <tbody>and<tfoot>elements together to define the various parts of a table (header, body, footer).

By using these elements, browsers are able to support scrolling of the table body independently of the table header and footer. When a long table that spans multiple pages is printed, the table header and footer can be printed on each page containing table data.

The <thead> tag must be used in the following context: as a child of a <table> element, appearing after any <caption> and <colgroup> elements, and before any <tbody>, <tfoot>, and <tr> elements.


Tips and Notes

Note:The <thead> element must contain one or more <tr> tags inside.

Tip:The <thead>, <tbody>, and <tfoot> elements do not affect the table layout by default. However, you can use CSS to style these elements and change the appearance of the table.


Differences between HTML 4.01 and HTML5

In HTML5, none of the attributes of the <thead> tag supported in HTML 4.01 are supported.


Attributes

Attribute Value Description
align right
left
center
justify
char
Not supported in HTML5.Defines the alignment of the content in the <thead> element.
char character Not supported in HTML5.Specifies the character on which the content in the <thead> element is aligned.
charoff number Not supported in HTML5.Specifies the offset of the first alignment character in the content of the <thead> element.
valign top
middle
bottom
baseline
Not supported in HTML5.Specifies the vertical alignment of the content in the <thead> element.


Global Attributes

The <thead> tag supports theHTML Global Attributes。


Event Attributes

The <thead> tag supports theHTML Event Attributes。

Other Extensions