HTML <tfoot>
Tag
Example
HTML table with <thead>
, <tfoot>
, and <tbody>
elements:
<table border="1">
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>
Browser Support
All major browsers support the <tfoot>
tag.
Tag Definition and Usage
The <tfoot>
tag is used to group footer content in an HTML table.
The <tfoot>
element should be used in conjunction with the <thead>
and <tbody>
elements to specify each part of the table (footer, header, body).
By using these elements, browsers can support scrolling of the table body independently of the table header and footer. When printing a table that spans multiple pages, the table header and footer can be printed on each page that contains table data.
The <tfoot>
tag must be used in the following context: as a child of a <table>
element, after <caption>
, <colgroup>
, and <thead>
elements, and before <tbody>
and <tr>
elements.
Tips and Notes
Note: The <tfoot>
element must contain one or more <tr>
tags.
Tip: The <thead>
, <tbody>
, and <tfoot>
elements do not affect the layout of the table by default. However, you can use CSS to style these elements and change the appearance of the table.
Differences Between HTML 4.01 and HTML5
In HTML5, all attributes of the <tfoot>
tag from HTML 4.01 are no longer supported.
Attributes
Attribute | Value | Description |
---|---|---|
align | right <br>left <br>center <br>justify <br>char | HTML5 does not support. Defines the alignment of the content in the <tfoot> element. |
char | character | HTML5 does not support. Specifies the character to align the content in the <tfoot> element. |
charoff | number | HTML5 does not support. Specifies the offset of the first alignment character in the content of the <tfoot> element. |
valign | top <br>middle <br>bottom <br>baseline | HTML5 does not support. Specifies the vertical alignment of the content in the <tfoot> element. |
Global Attributes
The <tfoot>
tag supports HTML's global attributes.
Event Attributes
The <tfoot>
tag supports HTML's event attributes.