tags:

views:

200

answers:

4

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?

+2  A: 

If by "top of my table" you mean above the tbody, this is "By Design": http://www.w3schools.com/tags/tag_tfoot.asp

You can't fault it for working the way it's suppose to :)

Jonathan Sampson
+1--you're probably right about the issue OP's reporting
Michael Haren
The name `tfoot` is misleading I think. That might be what caused the confusion.
Jonathan Sampson
it's not misleading at all - it's the footer for the table. the problem is just assuming that you have to define it in a certain place
nickf
A: 

As Mr. Sampson said the w3schools.com site clearly states that the tfoot tag must be present in the code before the tbody tag.

However the information contained in the tfoot tag should be rendered after the tbody tag. If you are having issues with the tfoot row rendering before your tbody rows I would take a look at your CSS code. Firebug is great for finding strange CSS issues.

Steven Potter
+1  A: 

Your table should look like the following:

<table>
    <thead>...</thead>
    <tfoot>...</tfoot>
    <tbody>...</tbody>
</table>

with tfoot appearing above tbody. It will render, though, at the bottom of the table

K Prime
A: 

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.

nickf
Ain't it annoying when standards don't make sense. "ACBDEFG..."
Nick Bedford