A hidden attribute on a <tfoot> tag hides the table footer.
Although the table footer is not visible, its position on the page is maintained.
A hidden attribute on a <tfoot> tag.
The table footer is not visible.
First Name | Last Name |
---|---|
Denice | Hobermann |
Paulo | Cornell |
Jane | Hollander |
Number of finalists: 3 |
<style>
table.tb { width: 250px; border-collapse: collapse; }
.tb th, .tb td { border: solid 1px #777; padding: 5px; }
.tb tfoot { background-color:lightblue; }
</style>
<table class="tb">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>Denice</td>
<td>Hobermann</td>
</tr>
<tr>
<td>Paulo</td>
<td>Cornell</td>
</tr>
<tr>
<td>Jane</td>
<td>Hollander</td>
</tr>
</tbody>
<tfoot hidden>
<tr>
<td colspan="2">Number of finalists: 3</td>
</tr>
</tfoot>
</table>
The hidden attribute hides the <tfoot> element.
You can specify either 'hidden' (without value) or 'hidden="hidden"'. Both are valid.
A hidden <tfoot> element is not visible, but it maintains its position on the page.
Removing the hidden attribute makes it re-appear.
<tfoot hidden>
<tfoot hidden="hidden">
Value | Description |
---|---|
hidden | Use 'hidden' or hidden='hidden'. Both are valid. |
Clicking the button toggles A hidden attribute on the <tfoot> element.
First name | Last name |
---|---|
Denice | Hobermann |
Paulo | Cornell |
Jane | Hollander |
Number of finalists: 3 |
<style>
table.tbl { width: 250px; border-collapse: collapse; }
.tbl th, .tbl td { border: solid 1px #777; padding: 5px; }
.tbl tfoot { background-color:lightblue; }
</style>
<table class="tbl">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
</tr>
</thead>
<tbody>
<tr>
<td>Denice</td>
<td>Hobermann</td>
</tr>
<tr>
<td>Paulo</td>
<td>Cornell</td>
</tr>
<tr>
<td>Jane</td>
<td>Hollander</td>
</tr>
</tbody>
<tfoot id="mytfoot">
<tr>
<td colspan="2">Number of finalists: 3</td>
</tr>
</tfoot>
</table>
<br />
<button onclick="toggle(this)">Hide tfoot</button>
<script>
let toggle = button => {
let element = document.getElementById("mytfoot");
let hidden = element.getAttribute("hidden");
if (hidden) {
element.removeAttribute("hidden");
button.innerText = "Hide tfoot";
} else {
element.setAttribute("hidden", "hidden");
button.innerText = "Show tfoot";
}
}
</script>
Initially, the <tfoot> is visible.
Clicking the button calls JavaScript that toggles the hidden attribute.
With the hidden attribute the table footer is invisible.
Here is when hidden support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |