HTML - <tfoot> Tag
Introduction to <tfoot> Tag
The HTML <tfoot> tag is used to define the footer section for a table. It is used to summarize data or provide additional information about the content of the table. It is the part of the table structure and works alongside <thead> and <tbody>.
The main advantage of using the <tfoot> tag is that it allows the browsers to render the footer before loading the table body, which can improve the accessibility when dealing with the large datasets.
Syntax
Following is the syntax of HTML <tfoot> tag −
<tfoot>...</tfoot>
Attributes
HTML <tfoot> tag supports Global and Event attributes of HTML. Below mentioned attributes are deprecated so use CSS properties rather using these attributes.
| Attribute | Value | Description |
|---|---|---|
| align | left right center justify |
Specifies the alignment of text content(Deprecated). |
| bgcolor | color | Specifies the background color of each column cell(Deprecated). |
| char | character | Specifies the alignment of the content to a character of each column cell(Deprecated). |
| charoff | number | Specifies the number of characters to offset the column cell content from the alignment character specified by the char attribute(Deprecated). |
| valign | baseline bottom middle top |
Specifies the vertical alignment of each column cell(Deprecated). |
Example : Basic Footer
Let's look at the following example, where we are going to consider the basic usage of the <tfoot> tag.
<!DOCTYPE html>
<html>
<body>
<table border="1">
<thead>
<tr>
<th>Students</th>
<th>English Marks</th>
<th>Hindi Marks</th>
</tr>
</thead>
<tfoot>
<tr>
<th colspan="3">Juliet - the best Performer!</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>John</td>
<td>28</td>
<td>25</td>
</tr>
<tr>
<td>Peterson</td>
<td>25</td>
<td>25</td>
</tr>
<tr>
<td>Juliet</td>
<td>29</td>
<td>29</td>
</tr>
</tbody>
</table>
</body>
</html>
Example : Applying CSS
Consider the following example, where we are going to apply the CSS to the <tfoot> tag separately.
<!DOCTYPE html>
<html>
<style>
tfoot {
background-color: #3f87a6;
}
</style>
<body>
<table border="1">
<thead>
<tr>
<th>Items</th>
<th>Price</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Total</th>
<th>75</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>5-Star</td>
<td>10</td>
</tr>
<tr>
<td>Dairy-Milk</td>
<td>45</td>
</tr>
<tr>
<td>KitKat</td>
<td>20</td>
</tr>
</tbody>
</table>
</body>
</html>
Example : Using for Additional Text
In the following example, we are going to use the <tfoot> tag to providing the additional content about the data in the table.
<!DOCTYPE html>
<html>
<body>
<table border="1">
<thead>
<tr>
<th>Student</th>
<th>GradePoints</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="2">*Grades are out of 10</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Suresh</td>
<td>8</td>
</tr>
<tr>
<td>Ramesh</td>
<td>9</td>
</tr>
</tbody>
</table>
</body>
</html>
Supported Browsers
| Tag | ![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|---|
| tfoot | Yes | Yes | Yes | Yes | Yes |




