tags:

views:

268

answers:

4

A table that extends onto multiple printed pages will have its thead and tfoot sections reprinted in firefox. This is usually great, however, is there a way to turn off this behavior with CSS?

[UPDATE] Thanks for the response so far. I would like to have the tfoot print once at the bottom of the table but not at the end of each page. Thanks again.

A: 

I believe it's a client preference - others have suggested a javascript solution to generate a printable page, especially if the footer of your table has totals or the like.

Andy Mikula
+2  A: 
<link rel='stylesheet' src='something.css' media='print'>

And in that style sheet, hide (display: none) or do whatever you want with the thead and tfoot elements. If the table is dynamically generated, you can check its size with javascript and apply the appropriate class in that print stylesheet.

geowa4
+2  A: 

The easy solution: don't use tfoot. Put the footer row(s) at the end of tbody. Now they'll print at the end of the table and no where else.

Shog9
Thought of that, however, I want to use a jquery's tablesorter which nicely ignores thead and tfoot when sorting.
Brian Fisher
How about using a separate table (or DIV) below the table you're printing then?
Shog9
Yeah that will work, but to get the columns to line up I'll need to either fix the width of each column or set them in javascript.
Brian Fisher
A: 

I found another way to do this:

<tfoot style="display: table-row-group">
</tfoot>

This works for Firefox, but of course, the display property is notoriously not cross-browser compatible.