Sometimes, we want to force a page break in HTML printing with CSS.
In this article, we’ll look at how to force a page break in HTML printing with CSS.
How to force a page break in HTML printing with CSS?
To force a page break in HTML printing with CSS, we set the page-break-before
property.
For instance, we write
@media print {
.pagebreak {
page-break-before: always;
}
}
to use page-break-before: always;
to force a page break in the element with class pagebreak
.
Conclusion
To force a page break in HTML printing with CSS, we set the page-break-before
property.