Skip to content

CSS Page Breaks in HTML to PDF: Tested Examples and Limits

By Durim Hoti · Published · Tests run on November 20, 2026 with Chrome 158.0.8127.36

CSS has rules for where a PDF page may break: start a new page, keep a block together, don't leave single lines behind. Whether they work depends on the tool that turns the HTML into a PDF. We ran the same ten HTML files through Chrome's print engine (what Print → Save as PDF uses) and through the HTMLSuite HTML to PDF converter and compared where each page ended.

The results below hold for the versions and settings we tested: Chrome 158.0.8127.36 and the converter as of November 20, 2026, both on A4 with 20 mm margins. Other browsers, versions or settings can break pages differently.

Results at a glance

Rule testedChrome printHTMLSuite converter
break-before: page (item in a flex column)AppliedApplied
break-inside: avoid (block across the page end)AppliedApplied
<thead> / <tfoot> of a 3-page tableRepeated on every pageHeader on page 1 only, footer on the last page only
orphans: 4AppliedNot applied
widows: 4AppliedNot applied
Heading that just fits at a page end, no ruleLeft alone at the end of the pageMoved to the next page with its text
Same heading with break-after: avoidMoved to the next pageMoved to the next page

Both followed the rules that start a page or keep a block together. They differed on repeated table headers and footers, on orphans and widows, and on headings at the end of a page.

How we tested

  • Ten HTML files, each testing one rule, most with a control file without the rule. Every file went unchanged into both engines.
  • Chrome print: Chrome 158.0.8127.36 (headless) on Windows 11, A4, 20 mm margins on every side, background graphics on.
  • HTMLSuite: the file opened in the HTML to PDF converter with its default settings: A4, portrait, normal (20 mm) margins, backgrounds on, then Convert to PDF.
  • Fixed typography (Arial, 16 px text, 20 px line height, lines separated by <br>), so line wrapping couldn't differ. We then read the text of every PDF page to see where each line landed. Every test ran at least twice with the same result.

Start content on a new page

break-before: page starts an element on a new page and break-after: page ends the page after it. We tested break-before: both engines applied it, also on an item inside a flex column. break-after wasn't part of this test set. The older page-break-before: always is the same rule under its earlier name.

CSS
.cover   { break-after: page; }   /* the cover is a page of its own */
.chapter { break-before: page; }  /* every chapter starts on a new page */

Keep a block on one page

Without a rule, a 300 px box that crossed the page end was split in both engines. With break-inside: avoid, both moved the whole box to the next page. Use it for cards, figures, signature blocks and short tables.

CSS
.card, figure, .totals { break-inside: avoid; }

Table headers and footers on every page

We printed a 70-row table with a <thead> and a <tfoot> that ran over three pages, without any extra CSS. Chrome print repeated the header at the top and the footer at the bottom of every page. The HTMLSuite converter showed the header only on page 1 and the footer only after the last row, on page 3.

End of page 1 and start of page 2 of the same 70-row table. Chrome print shows the footer row FOOTROW at the bottom of page 1 and the header row HEADROW at the top of page 2; the HTMLSuite converter shows neither.
The same table at the page break: Chrome print repeats header and footer, the HTMLSuite converter doesn't.
HTML
<table>
  <thead><tr><th>Item</th><th>Amount</th></tr></thead>
  <tfoot><tr><td>Total</td><td>…</td></tr></tfoot>
  <tbody>
    <!-- many rows -->
  </tbody>
</table>

If a long table needs its header on every page in the HTMLSuite converter, split it into one table per page, each with its own <thead>, and start each with break-before: page. The converter's Print / Save as PDF button opens your browser's print dialog instead; we didn't test that button separately.

Orphans and widows

orphans sets the minimum number of a paragraph's lines left at the bottom of a page, widows the minimum carried over to the top of the next. We placed a 10-line paragraph so that it crossed the page end.

  • With room for 2 lines on page 1, both engines split it 2 + 8 without a rule. With orphans: 4, Chrome print moved all ten lines to page 2; the HTMLSuite converter still split 2 + 8.
  • With room for 8 lines, both split it 8 + 2 without a rule. With widows: 4, Chrome print split it 6 + 4; the HTMLSuite converter still split 8 + 2.
A 10-line paragraph with orphans: 4. Chrome print moves all ten lines to page 2; the HTMLSuite converter keeps two lines on page 1 and eight on page 2.
orphans: 4 — Chrome print moves the paragraph, the HTMLSuite converter leaves two lines behind.
A 10-line paragraph with widows: 4. Chrome print splits it into 6 lines on page 1 and 4 on page 2; the HTMLSuite converter splits it 8 + 2.
widows: 4 — Chrome print carries four lines over, the HTMLSuite converter two.
CSS
p { orphans: 3; widows: 3; }      /* applied by Chrome print in our test */
p.short { break-inside: avoid; }  /* keeps a short paragraph whole */

In the HTMLSuite converter, break-inside: avoid on a short paragraph keeps it whole instead: the converter applied that rule in our box test. For long paragraphs, check the dashed page lines in its preview and add a break-before: page where a split looks wrong.

Headings at the end of a page

A heading that only just fits at the bottom of a page ends up separated from its text. Without any rule, Chrome print left the heading alone at the end of page 1 and started the text on page 2. The HTMLSuite converter moved the heading to page 2 together with its first line, because it keeps headings with the text that follows on its own. With break-after: avoid on the heading, both put it on page 2.

A heading that fits at the end of page 1, without CSS rules. Chrome print leaves HEADING alone at the bottom of page 1; the HTMLSuite converter moves it to page 2 with the text that follows.
A heading at the page end without CSS: left behind by Chrome print, moved along by the HTMLSuite converter.
CSS
h1, h2, h3 { break-after: avoid; }

Limits of these tests

  • Only Chromium was tested: Chrome 158.0.8127.36 and the HTMLSuite converter as of November 20, 2026. Firefox and Safari printing, other PDF libraries and other versions may behave differently.
  • The page end fell about one line apart in the two engines, so we adjusted the position of the orphans test until both control files split the same way.
  • Not tested here: @page rules, @media print styles, page sizes other than A4, and other margin settings.

Which one to use

Pick the method that follows the rules your document depends on. In our tests, Chrome print repeated table headers and applied orphans and widows. The HTMLSuite converter shows the page breaks in a preview before you export, and kept headings with their text without extra CSS. Both applied break-before and break-inside: avoid. The comparison table on the converter page covers text quality and other differences, and the converter page explains how to make a PDF step by step.