CSS

From Leaky
Jump to: navigation, search

Page breaks when printing

Extract from https://davidwalsh.name/css-page-breaks

The CSS

The all and print medias should be addressed:

@media all {
    .page-break    { display: none; }
}

@media print {
    .page-break    { display: block; page-break-before: always; }
}

The first declaration ensures that the page-break is never seen visually...while the second ensures that the page break is seen by the printer.

The HTML

Creating a simple DIV element with the page-break class is how you implement the page break.

<div class="page-break"></div>