HTML thead tag

HTML <thead> tag defines the heading section of the table. It contains the title (headings) of columns.

<table class="demoTable">
<thead id="design">
<tr> <th>Month</th> <th>Expenses</th> </tr>
</thead>

<tbody>
<tr> <td>June</td> <td>$80000</td> </tr>
<tr> <td>July</td> <td>$70000</td> </tr>
<tr> <td>August</td> <td>$40000</td> </tr>
<tr> <td>September</td> <td>$26000</td> </tr>
</tbody>

<tfoot>
<tr> <td>Total</td> <td>254000</td> </tr>
</tfoot>
</table>
</>
Month Expenses
June $80000
July $70000
August $40000
September $26000
Total 254000

The red background-color of thead distinguishes it from tbody and tfoot sections.

You can see the headings of columns have been given in the thead element.

Tag omission

Both tags may be omitted.

Global Attributes

All the global attributes are applicable on the thead element.



Was this article helpful?