As Chaim Evgi mentioned in this article http://davidwalsh.name/css-page-breaks
In addition to what is already described in this article, I would like to point out that it is good practice to use .page-break-before: auto instead of .page-break-before: always. "Auto" breaks the page only if the content is at the end of the page, this will prevent page breaks and leave a lot of free space.
CSS
@media all { .page-break { display: none; } } @media print { .page-break { display: block; page-break-before: auto; } }
HTML
<div>some content</div> <div class="page-break">more content, this content may be short or long</div> <div class="page-break">this content may page-break if content above this <div> is at the end of the page</div> <div class="page-break">etc,..</div>
Michael berrios
source share