views:

420

answers:

2

Is it possible to repeat table headers in Safari on every printed page?

This code works in Firefox but not in Safari:

<table>
  <thead>
    <tr>
      <td>Header1</td>
      <td>Header2</td>
    </tr>
  </thead>

  <!-- lots of rows -->
</table>

Edit:

This doesn't change anything, therefore it can't be the same bug that IE has:

thead { display:table-header-group; }
A: 

You may want to consider creating a CSS sheet for the printed version of your page. If you opt for that route, use the "position:fixed;". Elements positioned as 'fixed' are printed on every printed page.

The tricky part is that any positioned element (i.e. position property is not 'static') is taken out of the document flow. This makes alignment, of other (regular flowing) elements with the fixed elements tough.

Based on the information in your question, I would wrap the entire table in a fixed element (or create a class such as .printedTable with the position property set to fixed). This way, the table structure would repeat on each printed page.

Good luck. A.

Ahmed
Only the header of the table should be repeated, not the whole table as it is larger than a single page.
Georg
I would create just a 'fixed' header element so it repeats on every page and set the page top margin to a large enough value to prevent the page / table content from being rendered under the fixed heading. The pages can then have the table content printed with the header repeated on every prntd page
Ahmed
+1  A: 

To answer my own question:

After googling and getting no correct answer I think that there exists simply no method to accomplish it. Maybe later versions of Safari will include it.

Georg