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.

AttributeValueDescriptionDTD
alignright
left
center
justify
char
Aligns the content inside the <tfoot> elementSTF
charcharacterAligns the content inside the <tfoot> element to a characterSTF
charoffnumberSets the number of characters the content inside the <tfoot> element will be aligned from the character specified by the char attributeSTF
valigntop
middle
bottom
baseline
Vertical aligns the content inside the <tfoot> elementSTF

5. Standard Attributes

The <tfoot> tag supports the following standard attributes:

AttributeValueDescriptionDTD
classclassnameSpecifies a classname for an elementSTF
dirrtl
ltr
Specifies the text direction for the content in an elementSTF
ididSpecifies a unique id for an elementSTF
langlanguage_codeSpecifies a language code for the content in an elementSTF
stylestyle_definitionSpecifies an inline style for an elementSTF
titletextSpecifies extra information about an elementSTF
xml:langlanguage_codeSpecifies a language code for the content in an element, in XHTML documentsSTF

6. Event Attributes

The <tfoot> tag supports the following event attributes:

AttributeValueDescriptionDTD
onclickscriptScript to be run on a mouse clickSTF
ondblclickscriptScript to be run on a mouse double-clickSTF
onmousedownscriptScript to be run when mouse button is pressedSTF
onmousemovescriptScript to be run when mouse pointer movesSTF
onmouseoutscriptScript to be run when mouse pointer moves out of an elementSTF
onmouseoverscriptScript to be run when mouse pointer moves over an elementSTF
onmouseupscriptScript to be run when mouse button is releasedSTF
onkeydownscriptScript to be run when a key is pressedSTF
onkeypressscriptScript to be run when a key is pressed and releasedSTF
onkeyupscriptScript to be run when a key is releasedSTF

Relative articles