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
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
Share Improve this question asked Jan 13, 2015 at 18:30 ConfusedUserConfusedUser 3911 gold badge4 silver badges14 bronze badges 2-
stick enough
<br>
tags between them, and they'll end up on different pages. Or, you could just style for print ! – adeneo Commented Jan 13, 2015 at 18:33 - 1 Good way to choke on <br>'s ... :) – sodawillow Commented Jan 13, 2015 at 18:36
1 Answer
Reset to default 35You 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>