I'd like to use a <tfoot>
tag in a table to be semantically correct, but it keeps showing up at the the top of my table. Is there a way to tell it to display at the bottom?
The <tfoot> tag is used to group footer content in an HTML table. The <tfoot> element is used in conjunction with the <thead> and <tbody> elements to specify each part of a table (footer, header, body). Browsers can use these elements to enable scrolling of the table body independently of the header and footer.
To place an item at the top or bottom of its cell, insert the "VALIGN=" attribute within the code for that cell. To vertically align an entire row (e.g., placing all data in that row at the tops of the cells), insert the "VALIGN=" attribute within the code for that row.
<tfoot>: The Table Foot element. The <tfoot> HTML element defines a set of rows summarizing the columns of the table.
As others have said, tfoot
is defined before the tbody
but rendered afterwards. This is by design and doesn't change the semantics (a table has a head, a foot and a body - the order of these doesn't matter)
The reason it's done this way is so that the foot can be loaded and displayed on screen while the body is still downloading, so you can still read the summary information you have in the foot. It's virtually moot these days, but with a slow connection and a massive table, you might still see the benefits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With