tfoot element

If you don't know what an element is or how you must use it, I recommend you read the "HTML tags and attributes" tutorial that you can find in the HTML tutorials section.

Description

The tfoot element contains a block of rows (tr) representing a footer section of a table. This element can be useful to insert cells providing, among others, summaries or average values for the data in each column.

The tfoot element can only be present once in the table and must take place at its end, right after all of its bodies.

In previous versions of the standard, the tfoot element had several presentational attributes that have been removed in the HTML5 specification. Authors should drop their use in favor of style sheets.

Previously, HTML5 allowed tfoot to precede the body in the code, letting browsers fix its position to the bottom of the table when rendering. This behavior is no longer valid, and tfoot should alway be after any body of the table.

Examples

The next example consists of a table with a header (thead) and a footer (tfoot) that summarizes the information displayed by it.

<table class="egt">
  <thead>
    <tr>
      <th>Contributor</th>
      <th>Amount</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Jhon Doe</td>
      <td>$1,500.00</td>
    </tr>
    <tr>
      <td>William Park</td>
      <td>$750.00</td>
    </tr>
    <tr>
      <td>Sean Carpenter</td>
      <td>$500.00</td>
    </tr>
    <tr>
      <td>Steven Seagull</td>
      <td>$3,000.00</td>
    </tr>
    <tr>
      <td>Frank Furt</td>
      <td>$2,000.00</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <th>Total</th>
      <th>$7,750.00</th>
    </tr>
  </tfoot>
</table>
Contributor Amount
Jhon Doe $1,500.00
William Park $750.00
Sean Carpenter $500.00
Steven Seagull $3,000.00
Frank Furt $2,000.00
Total $7,750.00

Attributes

Specific attributes

align

The horizontal alignment of text in all affected cells. There are five possible values (case-insensitive):

  • left: text is aligned to the left margin. This is the default value for data cells (td).
  • center: text is centered. This is the default value for header cells (th).
  • right: text is aligned to the right margin.
  • justify: text is justified or aligned to both margins.
  • char: text is aligned to a specific character. It's used together with the char attribute.

This attribute has become obsolete in HTML5 and, therefore, its use is no longer valid. Authors should replace it with style sheet declarations.

Example

<tfoot align="center">

char

A caracter that will act as axis for text alignment. It's meant to work together with the align attribute when it has the "char" value. In other situations it will be completely ignored.

This attribute has become obsolete in HTML5 and its use is consequently invalid. Authors are adviced to replace it with style sheet declarations.

Example

<tfoot align="char" char="c">

charoff

An offset, from the first occurrence of the alignment caracter (specified in the char attribute) and in the direction of the text. The resulting character of this calculation will be the axis for text alignment.

For this attribute to be considered, the align attribute's value must be "char" and the char attribute must be present.

This attribute is considered obsolete by HTML5 and its use is no longer recommended. Authors should drop its use in favor of style sheets.

Example

<tfoot align="char" char="t" charoff="7">

valign

The vertical alignment of text in all affected cells. There are four possible values (case-insensitive):

  • top: text is aligned to the top margin.
  • middle: text is vertically centered.
  • bottom: text is aligned to the bottom margin.
  • baseline: all the cells in a row with this alignment should have their first text line on a common baseline.

This attribute is obsolete according to the HTML5 standard and, therefore, invalid. Authors are adviced to avoid its use and replace it with style sheet declarations.

Example

<tfoot valign="top">

Global attributes

For information about global attributes refer to this list of global attributes in HTML5.

Events

Global events

For information about global events refer to this list of global events in HTML5.