HTML <tfoot> Element
The <tfoot> tag is used in HTML tables to define a footer for the table.
It is used to group the footer content of a table together and is typically placed
after the <tfoot> tag.
Example:
Here is an example of a simple table with a footer:
<table>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
<tr>
<td>Jane</td>
<td>Smith</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">Total: 2 persons</td>
</tr>
</tfoot>
</table>
| First Name | Last Name |
|---|---|
| John | Doe |
| Jane | Smith |
| Total: 2 persons | |
Attributes of <tfoot> tag:
The <tfoot> tag supports the following attributes:
| Attribute | Description |
| align | Specifies the horizontal alignment of the content inside the <tfoot> tag. |
| valign | Specifies the vertical alignment of the content inside the <tfoot> tag. |
Example:
Here is an example of the align attribute in action:
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>
<tfoot align="center">
<tr>
<td>Footer 1</td>
<td>Footer 2</td>
</tr>
</tfoot>
</table>
| Header 1 | Header 2 |
|---|---|
| Footer 1 | Footer 2 |
That's it! You now know how to use the <tfoot> tag in HTML.