HTML / CSS / JavaScript Tutorial

HTML Element: <tfoot>

[this page | pdf | back links]

The HTML <tfoot> element indicates the footer content in a table. It appears inside a <table> element and is used in conjunction with <tbody> and <thead> elements to differentiate between different parts of the table. This can allow browsers to scroll the table body independently of the header and footer, or to allow printing of the header and footer at the top and bottom of each page. A <tfoot> element needs to come after any <caption>, <colgroup> and <thead> elements and before any <tbody> and <tr> elements.


The attributes it can take are HTML global attributes and HTML event attributes.


It used to support the align, char, charoff and valign attributes, but these are no longer supported by HTML 5.


To create or access such an element in JavaScript see here. The corresponding HTML DOM object supports standard DOM properties and methods. The default style applicable to this element is shown here.



<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
table,td,th,tr,caption {border: thin solid black; border-collapse: collapse;}
th {background-color: yellow;}
thead {color: blue}
tbody {color: black}
tfoot {color: green}
Created using HTML:<br>

<br>Created using JavaScript:<br>
<span id="element"></span>

var y4a1 = document.createElement("TD"); y4a1.textContent = "a";
var y4a2 = document.createElement("TD"); y4a2.textContent = "b";
var y4a = document.createElement("TR"); y4a.appendChild(y4a1); y4a.appendChild(y4a2);
var y4 = document.createElement("TFOOT"); y4.appendChild(y4a);
var x = document.createElement("TABLE");


Contents | Prev | Next | HTML Elements

Desktop view | Switch to Mobile