Tag <tfoot> HTML Reference



Example

An HTML table with a <thead>, <tfoot>, and a <tbody> element:

<table>
  <thead>
    <tr>
      <th>ID</th>
      <th>Name</th>
    </tr>
  </thead>
  <tfoot>
    <tr>
      <td>1</td>
      <td>Andrew</td>
    </tr>
  </tfoot>
  <tbody>
    <tr>
      <td>2</td>
      <td>John</td>
    </tr>
    <tr>
      <td>3</td>
      <td>Richard</td>
    </tr>
  </tbody>
</table>

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

1. Definition and Usage

The <tfoot> tag is used to group footer content in an HTML table.

The <tfoot> element is used in conjunction with the <thead> and <tbody> elements to specify each part of a table (footer, header, body).

Browsers can use these elements to enable scrolling of the table body independently of the header and footer. Also, when printing a large table that spans multiple pages, these elements can enable the table header and footer to be printed at the top and bottom of each page.

The <tfoot> tag must be used in the following context: As a child of a <table> element, after any <caption>, <colgroup>, and <thead> elements and before any <tbody> and <tr> elements.


2. Tips and Notes

Note: The <tfoot> element must have one or more <tr> tags inside.

Tip: The <thead>, <tbody>, and <tfoot> elements will not affect the layout of the table by default. However, you can use CSS to let these elements affect the table's layout.


3. Differences Between HTML and XHTML

None


4. Optional Attributes

DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

Attribute Value Description DTD
align right
left
center
justify
char
Aligns the content inside the <tfoot> element STF
char character Aligns the content inside the <tfoot> element to a character STF
charoff number Sets the number of characters the content inside the <tfoot> element will be aligned from the character specified by the char attribute STF
valign top
middle
bottom
baseline
Vertical aligns the content inside the <tfoot> element STF

5. Standard Attributes

The <tfoot> tag supports the following standard attributes:

Attribute Value Description DTD
class classname Specifies a classname for an element STF
dir rtl
ltr
Specifies the text direction for the content in an element STF
id id Specifies a unique id for an element STF
lang language_code Specifies a language code for the content in an element STF
style style_definition Specifies an inline style for an element STF
title text Specifies extra information about an element STF
xml:lang language_code Specifies a language code for the content in an element, in XHTML documents STF

6. Event Attributes

The <tfoot> tag supports the following event attributes:

Attribute Value Description DTD
onclick script Script to be run on a mouse click STF
ondblclick script Script to be run on a mouse double-click STF
onmousedown script Script to be run when mouse button is pressed STF
onmousemove script Script to be run when mouse pointer moves STF
onmouseout script Script to be run when mouse pointer moves out of an element STF
onmouseover script Script to be run when mouse pointer moves over an element STF
onmouseup script Script to be run when mouse button is released STF
onkeydown script Script to be run when a key is pressed STF
onkeypress script Script to be run when a key is pressed and released STF
onkeyup script Script to be run when a key is released STF

Relative articles