HTML <thead> Tag
The <thead> tag is used to group header content in an HTML table.
The <thead> element is used in conjunction with the <tbody> and <tfoot> elements to specify each part of a table (header, body, footer).
Attributes
Attribute | Value | Description |
---|---|---|
align | right left center justify char |
Not supported in HTML5. Aligns the content inside the <thead> element |
char | character | Not supported in HTML5. Aligns the content inside the <thead> element to a character |
charoff | number | Not supported in HTML5. Sets the number of characters the content inside the <thead> element will be aligned from the character specified by the char attribute |
valign | top middle bottom baseline |
Not supported in HTML5. Vertical aligns the content inside the <thead> element |
Example
<!DOCTYPE html> <html> <head> <style> thead {color:green;} tbody {color:blue;} tfoot {color:red;} table, th, td { border: 1px solid black; } </style> </head> <body> <table> <thead> <tr> <th>classroom</th> <th>students</th> </tr> </thead> <tfoot> <tr> <td>physics</td> <td>70</td> </tr> </tfoot> <tbody> <tr> <td>mathematics</td> <td>40</td> </tr> </tbody> </table> </body> </html>