Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it semantic/acceptable to put paging (NEXT/LAST, etc) links in a <tfoot> of a statistical table element?

having trouble deciding whether or not it makes sense to put paging information about a stats table in a <tfoot> element of the table.

information like "Page 1 of 13" and links to "next" & "prev," etc.

w3c <table> reference & examples don't do <tfoot> justice, IMO.

so, doing something like:

<table>
<caption>Stats Table!</caption>
<thead>
<tr>
    <th>1</th>
    <th>2</th>
    <th>3</th>
</tr>
</thead>

<tfoot>
    <tr>
        <td colspan="3">
            <a href="">prev pg</a>  <a href="">next pg</a>
        </td>
    </tr>
</tfoot>

<tbody>
    <tr>
        <td>a</td>
        <td>b</td>
        <td>c</td>
    </tr>
    <tr>
        <td>x</td>
        <td>y</td>
        <td>z</td>
    </tr>
</tbody>

with some minor styling looks like this (click for example on jsfiddle)

does this seem to fit into proper semantics of html tables? any references as to why or why not?

like image 210
Marc Smith Avatar asked Jul 07 '11 19:07

Marc Smith


1 Answers

I would say yes, that would be acceptable.

Traditionally, the <tfoot> is usually used to duplicate header information when a table must be broken across boundaries (think printed pages and things of that nature). It also can be used as a static footer when the <tbody> elements are rendered in a scrolling panel. I believe that is close enough to what you're trying to do.

As a side note, I'm glad to see you've placed the <tfoot> before the <tbody>. I can't begin to count how many times I see people put it at the bottom.

like image 133
Michael Irigoyen Avatar answered Dec 28 '22 13:12

Michael Irigoyen