Finding your way through a long document / Section divider page
A part title page that starts on the right and carries no folio
A page carrying only a part number and title, used to separate the major sections of a long document.
Why this block is harder than it looks
A divider is a cover page repeated, and it inherits every one of the cover page's problems plus one of its own: in a document that will be printed double sided, a divider should fall on a right-hand page, and whether it does depends on how many pages the previous part happened to take. Forcing that means asking the renderer to insert a blank page when the parity is wrong, which is a page rule feature rather than something you can compute in the content. The blank page it inserts also needs handling, because a blank page with a running header and a folio on it does not look blank.
The decisions that make it work
Reasons rather than a description of the code. Each of these is a choice that has a wrong answer, and the wrong answer is usually the default.
- Use break-before: right rather than break-before: page. That inserts a blank page when the parity requires one, which is exactly the behaviour a bound document needs.
- Give the divider a named page with empty margin boxes, so it carries no folio and no running header.
- Handle the inserted blank page with the blank page rule, emptying its margin boxes too, or the blank leaf carries a header and stops looking deliberate.
- Set the part number large and the title beneath it. The number is the navigational anchor and the title is the description.
- Position the block against the page rather than in the flow, so every divider sits at exactly the same height regardless of title length.
- Do not count the divider out of the page numbering. A reader looking for page 40 counts sheets, and skipping numbers makes the folio unreliable.
The fragment
Markup and the CSS it needs, and nothing else. It expects a document that already has a page rule and a base stylesheet, so paste it into one rather than opening it on its own.
<section class="divider">
<p class="part">Part 3</p>
<h1>Findings and recommendations</h1>
</section>
<style>
@page divider {
size: A4;
margin: 30mm 25mm;
@top-left { content: ""; }
@bottom-left { content: ""; }
@bottom-right { content: ""; }
}
@page :blank { /* the leaf inserted to fix the parity */
@top-left { content: ""; }
@bottom-left { content: ""; }
@bottom-right { content: ""; }
}
.divider {
page: divider;
break-before: right; /* always a right-hand page */
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
.divider .part {
margin: 0;
font-size: 10pt;
letter-spacing: 0.14em;
text-transform: uppercase;
color: #666;
}
.divider h1 { margin: 8pt 0 0; font-size: 26pt; line-height: 1.15; }
</style>What breaks when it is built the obvious way
Forcing the parity by inserting an empty div with a page break in it. It produces a blank page that is part of the flow, so it carries the body page rule and prints a header and a folio, and a reader looking at it sees an error rather than a deliberate blank.
How to prove it survived pagination
Render a document where one part ends on an odd page and another ends on an even page. Both dividers should land on right-hand pages, one of them preceded by a genuinely blank leaf with nothing printed on it. Then confirm the folio did not skip a number.
Where it sits in a finished document
This page is one block. The document it belongs to has a page rule, a base stylesheet, a header and everything else around it, and repeating all of that here would make thirty pages that say the same thing. The multi-page report template is a complete file with this block already in it, so take that and change the fragment rather than assembling one from parts. The property doing most of the work here is covered on its own page, with the support caveats that belong there rather than here.
Frequently asked
Will this fragment work on its own?
Not as a whole document. It has no page rule, no margins and no base type, because those belong to the document rather than to the block, and duplicating them in every fragment would mean thirty copies to keep in step. Paste it into a template that already has them.
Why does it look right in a browser and wrong in the PDF?
Because a browser window is one continuous surface and a document is a stack of fixed rectangles. Nothing in a scrolling view exercises a page boundary, so every break rule in the fragment is inert until the content is paginated. Render the real thing with enough content to cross two or three boundaries, then look.
Do I need a special option on the render request for this?
No. Everything on this page is CSS and markup, which is your side of the boundary. What the render has to give you is a real page size with real margins, and after that the layout is decided by the stylesheet.
Other parts of a document
The blocks that sit next to this one, and one from the next group along so you are not sealed inside a single kind of problem.
An attachments list that says what is attached and where it is
A list of documents that accompany this one, with enough identification that a reader can tell whether they have received everything.
A glossary with hanging indents that stays scannable
Defined terms with their definitions, set so a reader can find a term by scanning down the left edge.
An abbreviations list in columns that reads down, not across
Short forms with their expansions, usually at the front of a technical document, set compactly because there are often a lot of them.
A printed checkbox list with boxes big enough to tick by hand
A list of items each with a box to be ticked, used on inspection sheets, handover forms and anything filled in on paper.
Multi-page report, as a complete file
The whole document with this block already in place, ready to copy and change.
@page :first, :left, :right in paged output
The property carrying the weight here, with its real support status.
Every part of a document
The full list, grouped by the kind of problem the block poses.
Paste the fragment into the playground inside a page rule and see what it does at a real page size. That is the only way any of this gets confirmed.