- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
In HTML how to create table header?
Use the <thead> tag in HTML to create table header. The HTML <thead> tag is used in adding a header to a table. The thead tag is used in conjunction with the tbody tag and the tfoot tag in determining each part of the table (header, footer, body).
The HTML <thead> tag also supports the following additional attributes −
Attribute | Value | Description |
---|---|---|
align | right left center justify char | Deprecated − Visual alignment. |
char | character | Deprecated − Specifies which character to align text on. Used when align = "char" |
charoff | pixels or % | Deprecated − Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. Used when align = "char" |
valign | top middle bottom baseline | Deprecated − Vertical alignment. |
Example
You can try to run the following code to learn how to implement <thead> tag in HTML −
<!DOCTYPE html> <html> <head> <title>HTML thead Tag</title> </head> <body> <table style = "width:100%" border = "1"> <thead> <tr> <td colspan = "4">This is the head of the table</td> </tr> </thead> <tfoot> <tr> <td colspan = "4">This is the foot of the table</td> </tr> </tfoot> <tbody> <tr> <td>Cell 1</td> <td>Cell 2</td> <td>Cell 3</td> <td>Cell 4</td> </tr> <tr> ...more rows here containing four cells... </tr> </tbody> <tbody> <tr> <td>Cell 1</td> <td>Cell 2</td> <td>Cell 3</td> <td>Cell 4</td> </tr> <tr> ...more rows here containing four cells... </tr> </tbody> </table> </body> </html>
Advertisements