Difference between revisions of "CSS"

From Leaky
Jump to: navigation, search
(Tip about page breaks)
 
(No difference)

Latest revision as of 09:45, 13 September 2019

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>