HTML <tfoot> Tag

The <tfoot> tag defines the footer of an HTML table. It is used together with the <thead> and <tbody> elements, which define the header and the body of the table correspondingly.

The <tfoot> tag must be declared inside the <table> element, after the <caption>, <colgroup> (if any) and the <thead> elements. Note, that <tfoot> must be placed before <tbody>, so that the browser can render the table footer correctly.

The <tfoot> tag must contain at least one <tr> tag.

The <thead>, <tbody>, and <tfoot> elements do not affect the layout of the table by default. Use CSS properties to customize the look of the table.

Syntax

<table>
  <thead> ... </thead>
  <tfoot>
    <tr>
      <td> ... </td>
    </tr>
  </tfoot>
  <tbody> ... </tbody>
</table>

Example

<!DOCTYPE html>
<html>
  <head>
    <title>The title of the document.</title>
  </head>
  <body>
    <table summary="Goalscorers" width="400" border="1">
      <caption>
        FIFA World Cup 2018 Top Goalscorers
        <hr>
      </caption>
      <thead>
        <tr>
          <th>Name</th>
          <th>Country</th>
          <th>Goal</th>
        </tr>
      </thead>
      <tfoot>
        <tr>
          <th colspan="3">Harry Kane - the best player!</th>
        </tr>
      </tfoot>
      <tbody>
        <tr>
          <td>Harry Kane</td>
          <td>England</td>
          <td>6</td>
        </tr>
        <tr>
          <td>Christiano Ronaldo</td>
          <td>Portugal</td>
          <td>4</td>
        </tr>
        <tr>
          <td>Neymar</td>
          <td>Brazil</td>
          <td>2</td>
        </tr>
      </tbody>
    </table>
  </body>
</html>

Result

Attributes

Attribute Value Description
align right
left
center
justify
char
Sets horizontal alignment of the content inside the <tfoot> element.
This attribute is not supported by HTML5.
bgcolor bgcolor Sets the background color of the rows inside the <tfoot> element.
This attribute is not supported by HTML5.
char character Specifies the alignment of the content inside the <tfoot> element to a character. Is used only when the attribute align = "char".
This attribute is not supported by HTML5.
charoff number Specifies the number of characters the content inside the <tfoot> element will be aligned from the character specified by the charattribute. Is used only when the attribute align = "char".
This attribute is not supported by HTML5.
valign top
bottom
middle
baseline
Specifies a vertical alignment of the content inside the<tfoot> element.
This attribute is not supported by HTML5.

The <tfoot> tag also supports the Global Attributes and the Event Attributes.

Browser support