I have a dynamic table in my web page that sometimes contains lots of rows. I know there are page-break-before
and page-break-after
CSS properties. Where do I put them in my code in order to force page breaking if needed?
When you insert a manual page break (Ctrl+Enter) in a table, you split the table, and the empty paragraph is the result. To create a page break without splitting the table (which also allows your heading row(s) to repeat), apply the "Page break before" property to the row you want to appear on a new page.
The page-break-after property adds a page-break after a specified element. Tip: The properties: page-break-before, page-break-after and page-break-inside help to define how a document should behave when printed. Note: You cannot use this property on an empty <div> or on absolutely positioned elements.
page-break-before: auto instead of . page-break-before: always. The "auto" will break the page only if the contents are at the end if the page, this will prevent breaking the page and leaving a lot of blank space.
You can use the following:
<style type="text/css"> table { page-break-inside:auto } tr { page-break-inside:avoid; page-break-after:auto } </style>
Refer the W3C's CSS Print Profile specification for details.
And also refer the Salesforce developer forums.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With