I’m trying to generate a CSS class that will help me define a ‘page break’.
I know that if I use @media:print .MyDiv{ width:100%; height:100%; }, I can then set the class of a div to MyDiv and it will be — as best as possible — 1 page of print.
This is great, but I have encountered a new item that I don’t know how to handle, and I’m hoping that something similar can be done. I need to create an empty div that will stretch itself out to the ‘end of the page’.
Something like:
<style type='text/css'> @media print .PageBreak { width: 100%; height: *; /* space left on current page */ } @media screen .PageBreak { border-bottom: 1px solid black; } </style> <!-- ... --> <div>This should appear on the first page.</div> <div class='PageBreak'><!-- This DIV should stretch itself out so that the next piece of content appears on the next page (only when printing). --></div> <div>This should appear on the second page.</div>
This is for print, right?
Can’t you just use this?
There are some other options to page-break-before that are worth knowing about too.