English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <thead> element defines a group of rows that define the column headers of the table. These rows constitute the column titles in the HTML table. This tag is also commonly referred to as the <thead> element.
HTML table with <thead> element:
!doctype html> <html> <head> <meta charset="UTF-8"> <title>HTML thead tag usage (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> <table border="1"> <caption>Council budget (in £)< 2018</caption> <thead> <tr> <th scope="col">Items</th> <th scope="col">Expenditure</th> </tr> </thead> <tbody> <tr> <th scope="row">Donuts</th> <td>3,000</td> </tr> <tr> <th scope="row">Stationery</th> <td>18,000</td> </tr> </tbody> </table> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the <thead> tag.
<thead> tag is used to combine the header content of HTML tables.
<thead> elements should be used with <tbody> and <tfoot> elements combined together are used to specify the various parts of the 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 printing a long table that contains multiple pages, the table header and footer can be printed on each page that contains table data.
<thead> tag must be used in the following situations: as a child element of the <table> element, appearing after <caption> and <colgroup> elements, and before <tbody>. before <tfoot> and <tr> elements.
Notes:<thead> element must contain one or more <tr> tags.
Tip:<thead>, <tbody>, and <tfoot> elements do not affect the table layout by default. However, you can use CSS to define styles for these elements, thus changing the appearance of the table.
In HTML 5 No longer supports HTML 4.01 Any attribute of the <thead> tag inside.
Attribute | Value | Description |
---|---|---|
align | right left center justify char | HTML5 Not supported. Defines the alignment of the content within the <thead> element. |
char | character | HTML5 Not supported. Specifies the character to be used for text alignment within the <thead> element. |
charoff | number | HTML5 Not supported. Specifies the offset of the first alignment character of the content within the <thead> element. |
valign | top middle bottom baseline | HTML5 Not supported. Specifies the vertical alignment of the content within the <thead> element. |
Support for <thead> tag Global attributes of HTML.
Support for <thead> tag HTML event attributes.