Last Updated on April 26, 2023 by Roshan Parihar
Learn how to use the HTML thead tag in a table to create a heading row. It makes the top row of the table bold or increases the font-weight of the text. It is used in tables to show header.
You have to include an HTML <th> tag also to add text for table header.
Syntax:
1 |
<thead>table rows comes here with its cells</thead> |
A table rows comes in this tag to show header rows. Header cells in table is given by HTML th tag.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<p>Computer parts with its price:</p> <table> <thead> <tr> <th>Parts name</th> <th>Price(in $)</th> </tr> </thead> <tbody> <tr> <td>Hard Disk</td> <td>20</td> </tr> <tr> <td>Mouse</td> <td>6</td> </tr> <tr> <td>RAM</td> <td>10</td> </tr> </tbody> <tfoot> <tr> <td>Total</td> <td>36</td> </tr> </tfoot> </table> |
Output
Computer parts with its price:
Parts name | Price(in $) |
---|---|
Hard Disk | 20 |
Mouse | 6 |
RAM | 10 |
Total | 36 |
Resources and References
1. W3C Specification.
2. HTML living standard
3. W3C project using Github