Table footer. The HTML <tfoot> tag is used for adding a footer to a table. tfoot can be used just once within a table element and must appear before a tbody element.

The <tfoot> tag is used in conjunction with the <tfoot> tag and the <thead> tag in determining each part of the table (header, footer, body). Browsers can use this information to enable scrolling of the table body independently of the header and footer - particuarly useful for large tables. Also, when printing a large <table> that spans multiple pages, this information can enable the table header and footer to be printed at the top and bottom of each page.

Note: If you use this element, it must be declared in one of the following places:

  • As a child of a <table> element, after any <caption>, <colgroup>, and <thead> elements and before any <tbody> and <tr> elements, but only if there are no other <tfoot> elements that are children of the <table> element.

Required Attributes

  • None.

Optional Attributes

  • align can be used to horizontally align the cells within the element. The value can be left, center, right, justify or char.
  • valign can be used to vertically align the cells within the element. The value can be top, middle, bottom or baseline.
  • char can be used to specify a character with which cells will align, such as a decimal point. It is not supported by any major browser.
  • charoff can be used to specify the number of pixels the alignment should be offset from the char character. It is not supported by any major browser.
  • Common attributes

Example

<table>
	<thead>
		<tr>
			<th>Name</th>
			<th>Nationality</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<td>Footer 1</td>
			<td>Footer 2</td>
		</tr>
	</tfoot>
	<tbody>
		<tr>
			<td>John</td>
			<td>English</td>
		</tr>
		<tr>
			<td>Pedro</td>
			<td>Portuguese</td>
		</tr>
	</tbody>
</table>

Changes in HTML5

  • None.

Related Tags