The <tfoot>
tag is used to define a footer for an HTML table. The <tfoot>
tag should be used after all the <thead>
and <tbody>
tags in the table.
The <tfoot>
tag is used to group footer content in an HTML table. The content of the <tfoot>
tag is displayed at the bottom of the table, after all the rows in the table body (<tbody>
) have been displayed.
The <tfoot>
tag can contain one or more <tr>
tags, which in turn can contain one or more <th>
or <td>
tags. The <th>
and <td>
tags are used to define the cells in the table.
Example 1: Basic usage of <tfoot>
tag
Month | Savings |
---|---|
January | $100 |
February | $80 |
Total | $180 |
Example 2: Using <th>
tag in <tfoot>
tag
Month | Savings |
---|---|
January | $100 |
February | $80 |
Total | $180 |
Example 3: Using multiple <tr>
tags in <tfoot>
tag
Month | Savings |
---|---|
January | $100 |
February | $80 |
Total | $180 |
Average | $90 |
Example 4: Using colspan
attribute in <td>
tag
Month | Savings |
---|---|
January | $100 |
February | $80 |
Total Savings: $180 |
Example 5: Using rowspan
attribute in <td>
tag
Month | Savings |
---|---|
January | $100 |
$50 | |
February | $80 |
Total | $230 |
These are some examples of how the <tfoot>
tag can be used in an HTML table.