Oz Bar-Shalom Oz Bar-Shalom - 1 year ago 130
CSS Question

html - verify that each div will be on separated print page

I have many divs that proposed to be printed - on different pages.
How can I make sure that when the user is clicking the print button, each div will be on a different page?


Answer Source

You can use the page-break-after attribute in the print media query. The advantage is, that you don't have to change the size of your divs, it just makes sure that the page break will be after the div.

@media print {
    div {
        page-break-after: always;

More information about page-break-after on MDN.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download