thead, tfoot and tbody order in HTML5

Before HTML5, <tfoot> had to come after <thead> and before <tbody>. With HTML5, <tfoot> can come before <tbody> or after it. But there must be only one <tfoot> child of a <table> element, and it must be after <thead>.


In the HTML 5.1 spec, <tfoot> can only come after <tbody>.

In this order: optionally a caption element, followed by zero or more colgroup elements, followed optionally by a thead element, followed by either zero or more tbody elements or one or more tr elements, followed optionally by a tfoot element, optionally intermixed with one or more script-supporting elements.

https://www.w3.org/TR/html51/tabular-data.html#tabular-data


According to the W3 specs, tfoot has to come before tbody. (Links to specs here -> Why do internal TABLE sections have to go THEAD TFOOT TBODY to validate?)

This was done to allow the header and footer of a table to load first, before loading in a variable amount of body data, which would otherwise possibly block the loading of the table footer.

Tags:

Html