HTML
Table with Thead Tbody Tfoot
Structure tabular data with thead, tbody, tfoot, and caption in HTML.
By EZ4Code Team
tablebeginner
Code
<table>
<caption>Employee Salaries</caption>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Department</th>
<th scope="col">Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alice</td>
<td>Engineering</td>
<td>$95,000</td>
</tr>
<tr>
<td>Bob</td>
<td>Sales</td>
<td>$72,000</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">Total</td>
<td>$167,000</td>
</tr>
</tfoot>
</table>Explanation
Structures tabular data with thead (headers), tbody (data rows), and tfoot (summary) for clear semantics. scope="col" on th cells identifies header-to-column relationships for accessibility. caption provides a table title, and colspan merges cells for footer totals.
More HTML Snippets
Accessible Form with Inputs
Build an accessible HTML form with labels, inputs, select, and checkbox.
Responsive Images and Video
Embed responsive images with srcset, video, audio, and figure in HTML.
Links Anchors and Download
Create internal, external, anchor, email, phone, and download links in HTML.
Semantic Tags
HTML5 semantic structure.
Form Validation
HTML5 form validation.
SVG
Scalable Vector Graphics.