Web Development Course:
HTML tfoot: Main Tips
- To group footer content of an HTML table, you should use the
<tfoot>goes together with the <tbody> and <thead> to specify each part of table (footer, header, body).
<tfoot>should have one or more <tr> tags inside.
Defining HTML Table Footers
tfoot tag is used to define the content of the HTML table footer:
<table border="1"> <thead> <tr> <th>Cats</th> <th>Dogs</th> </tr> </thead> <tbody> <tr> <td>7</td> <td>6</td> </tr></tbody> <tfoot align="center"> <tr> <th colspan="2">Cats win!</th> </tr> </tfoot> </table>
One table can only have one
tfoot element. It should be positioned below the
<tbody> in the document flow.
Deprecated tfoot Tag Attributes
tfoot tag had a few specific attributes. However, they all have been deprecated in HTML4 and removed completely in HTML5. We'd advise you to use CSS properties for styling instead.
align defined the alignment of content for the
Note: instead of align, use the CSS text-align property.
char defined the alignment of content for the
<tfoot> element to a character:
<tfoot align="char" char=".">
charoff set the number of characters the content of the
<tfoot> element should be aligned from the character set by the
<tfoot align="char" char="." charoff="2">
valign set all the content of the
<tfoot> element to align vertically:
Note: instead of valign, use the CSS vertical-align property.
Mobile Browser Support
Creating, Modifying and Styling HTML Tables
HTML table: how to create a table in HTML? Learn how to use HTML table border property and find out how to make your first table in HTML.
HTML5 Tags List: Get to Know the Most Useful Elements
Find HTML5 tags explained and illustrated with beginner-friendly HTML5 examples. Grasp the difference between HTML5 tags & elements and learn to use both!