RE: correct use of tfoot

Antony Tennant wrote:
> 
> Here are my questions:-
> 1. Is the initial example accurate i.e a repeat of the thead cells
> (assuming the size of the table warrants it) 

This is/has been my general understanding, that the <tfoot> "echoes" the
<thead> so that there is <th> reference points at both the top and bottom.
However, I don't think the W3C specifically *mandates* as such, and I can
now think (based on the thread you quoted) that there would be no reason why
the content of the <tfoot> could not be *somewhat* different.

For example, if you had a long, matrix style table which tracked, say, sales
by department over 12 months, then I suspect it would be appropriate to have
the following:

<table>
  <thead>
    <tr>
      <th>Month</th>
      <th>Dairy</th>
      <th>Produce</th>
      <th>Butcher</th>
      <th>Dry Goods</th>
    </tr>
  </thead>
  <tfoot>
    <tr>
      <th></th>
      <th>{total Sales figure}</th>
      <th>{total Sales figure}</th>
      <th>{total Sales figure}</th>
      <th>{total Sales figure}</th>
    </tr>
  </tfoot>
  <tbody>
    <tr>
      <th>January</th>
      <td>$2,500.00</td> 
      <td>$3,500.00</td>
      <td>$4,500.00</td>
      <td>$5,500.00</td>
    </tr>

...etc.



> 2. If there was a general footnote relating to the table data, e.g
> "The charge will be refunded if the item is return undamaged" or the
> footnote was relating to a specific cell or column rate e.g *free
> delivery if purchased before 01/12/2006   

Hmmm... I would be careful that content of the <tfoot> was not *too*
disassociated with the columns and rows of your main table - I do not think
it is intended to be a "footnote" style construct - it is an integral part
of the overall table.

> 3. Does anyone have any good real-life examples I could look at
> 

I have used <tfoot> (along with CSS overflow on the <tbody>) on the table
at:
http://www.wats.ca/show.php?contentid=43  (note, the CSS overflow apparently
only works in Firefox - neither IE 7 not Opera 9 seem to support it)

Cheers!

JF

Received on Friday, 1 December 2006 17:30:11 UTC