CSS

From Leaky
Revision as of 09:45, 13 September 2019 by Leaky (talk | contribs) (Tip about page breaks)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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>