Search code examples
csssafarioperapage-break

CSS page-break-after within table in Safari?


I want each row of a table to be printed (media="print", not "screen") on separate page. So my HTML looks like this:

<table>
    <tr style="page-break-after: always;">
        <td><p>Page 1</p></td>
    </tr>
    <tr style="page-break-after: always;">
        <td><p>Page 2</p></td>
    </tr>   
</table>

The page break works in Firefox and IE but not in Safari 4 nor Opera.

I tried adding the "page-break-after: always" to <td> and <p> but neither works. I can't seem to find a way to force a page break within a table in Safari and Opera.

Any idea on how to make it work in all Browsers?


Solution

  • Hate to only half answer your question, but...

    In Opera, this will work with elements that are block elements (a table row is a table-row display type). As page-break-after applies only to those elements. I'm not sure how to make it work in Safari.

    style="display:block;page-break-after: always;"