What's the easiest way to do this? I've done some research and came up with the
<div style="page-break-before:always"> </div>
to put in the CSS 开发者_Go百科but I'm not sure how to do this. I'm using it to generate PDF's and I'm looking for a way to start a new page without filling up empty space on a previous one.
Not sure if I understand your concern fully, but creating a page break like that is the way to go.
Let's say you have some markup like:
<div>Some content here that doesn't fill the page</div>
<div style="page-break-before:always">Content here starts on a new page</div>
Then this will cause the second div to appear on a new page. Whether the previous page gets filled or not is upto the contents of the first div (or previous markup until that point).
The only requirement is that second div
should not be empty or hidden (this is why you at least need one whitespace character inside the div
). But if you have other content (and the content is visible
), you don't have to worry about that either.
Hope this makes sense.
精彩评论