Element tbody not allowed as child of element table in this context
The error
The W3C validator reports
Element tbody not allowed as child of element table in this context.
when a tbody comes after the tfoot of the same table. Some old guides still put tfoot first: HTML 4.01 required it there, so that a browser could draw the footer before a long body had loaded. Current HTML wants the parts in reading order.
The order of table parts
Inside table, in this order, each part optional:
- caption, the title of the table;
- colgroup elements;
- thead, the header rows;
- one or more tbody, or rows directly;
- tfoot, at most one, last.
The fix
Move tfoot after the last tbody:
<table> <caption>Table title</caption> <thead> <tr><th></th></tr> </thead> <tbody> <tr><td></td></tr> </tbody> <tfoot> <tr><td></td></tr> </tfoot> </table>
The browser shows the footer at the bottom either way; only the source order changes. Validate the page again, as described in Website testing.
Article authors: Andrei Olegovich, Klavdiya Kondakova