16

Assuming we have multiple html paragraph

<p>Paragraph 1</p>
<p>Paragraph 2</p>

Is there a way to print both to different page to the printer ?

Paragraph 1 would be printed on the first page and Paragraph 2 would be printed on the second page.

Thank You

2
  • stick enough <br> tags between them, and they'll end up on different pages. Or, you could just style for print ! Commented Jan 13, 2015 at 18:33
  • 1
    Good way to choke on <br>'s ... :) Commented Jan 13, 2015 at 18:36

1 Answer 1

35

You can do this using CSS page-break-after property:

@media print {
    p { page-break-after: always; }
}

It will print each p element on new page.

window.print()
@media print {
    @page { margin: 0; }
    p { page-break-after: always; }
}
<p>Paragraph 1</p>
<p>Paragraph 2</p>

Sign up to request clarification or add additional context in comments.

2 Comments

Love learning new things; page-break-after property. Thanks.
Note that this does not work in several scenarios for current Chrome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.