I have a document where I want the last section to appear on the next page completely, which works for the most part by using: page-break-before: always. Except when the section is too big to fit on a single page. Then an empty page is shown and then the section appears, but it is still broken up correctly. I want to avoid having this empty page.
So, what I expect is to have the first page, without this last section as it is forced onto the next page. Since this section is too large to fit on a single page what can be shown will be shown on the page and the rest is broken off onto the next page. I use a <span> for this section so it is allowed to be broken up. Using a <p> instead does not seem to change anything. And a <div> will absolutely not work as this will not be broken up at all and causes an error instead.
Sorry for interfering if this is already being handled in private messages, I just want to say that you probably should use an <article> instead. The page-break-before style is not supported for <span>.
Just in case it saves you some time, this is a simple test template I cobbled together earlier. I assume I’m doing something different since I don’t see a blank page.
If you add enough text on the first page where it still fits but there is not enough room to fit a new line and see what happens. An empty page is added after this before the <article> section begins. Shouldn’t the <article> section begin on the new page without an empty page being created in between?
You’re right, I would not expect to see a blank page in that case. That looks like a bug to me.
It is no longer reproducible with the next major update of Connect where we reworked that code, so perhaps we could (partially) backport that. I will create a ticket.
As for a workaround, it seems to behave better if the page-break-before style is changed to page-break-after and moved to a dummy <div> that is placed before the <article>: