Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use break-before to control a break before an element, break-after to control one after it, and break-inside to discourage splitting its content. In print, these properties work alongside orphans and widows, which set minimum paragraph-line groups at the bottom and top of pages. They influence pagination; they cannot guarantee that content of any size will stay intact.
Page breaks are part of CSS fragmentation
When a browser lays content across multiple pages, it uses paged media: a presentation made up of discrete pages. The rules that decide where content breaks are part of CSS fragmentation. Fragmentation also applies to other contexts, including multicolumn layouts, so the modern break-* properties are not exclusively about printed pages. See MDN’s guides to CSS paged media and CSS fragmentation.
For a print stylesheet, use @media print to scope page-specific rules. A declaration such as break-before: page asks for a new page before an element; it does not change the screen layout outside that media query. The final result also depends on content dimensions, page dimensions, print settings, and the browser or PDF renderer.
Recommended Free Tools
Which property controls which boundary?
| Property | Where it acts | Typical use |
|---|---|---|
break-before |
Before the element’s generated box | Start a chapter on a fresh page. |
break-after |
After the element’s generated box | End a section or other element with a requested break. |
break-inside |
Within the element | Discourage splitting a callout or other content across pages. |
orphans |
At the bottom of a page, within a paragraph | Set the minimum number of paragraph lines left before a break. |
widows |
At the top of the following page, within a paragraph | Set the minimum number of paragraph lines carried after a break. |
The placement distinction matters: a break at the boundary between two elements can be affected by declarations on both elements and on their container. The values do not all describe the same thing: page requests a page break in paged output, while avoid discourages breaking at the relevant location.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Use break-before for a break before an element
Apply break-before to the element that should begin after the boundary. This is usually the most direct choice for chapter headings or sections that must start on a new printed page.
@media print {
.chapter {
break-before: page;
}
}
Other fragmentation contexts can use the modern property’s corresponding break values for their own boundaries. Choose a value that matches the intended context rather than assuming every value means “start a new printed page.” The MDN reference for break-before describes the property and its values.
Use break-after for a break after an element
When the desired boundary belongs to the end of the current box, set break-after on that element. For example, this asks the renderer to put a page break after each element marked as a section-ending page:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →@media print {
.section-end {
break-after: page;
}
}
If a following heading already has break-before, both declarations address the same boundary. They are considered together with the containing element’s break-inside; they are not independent commands that always produce two separate blank pages.
Rank #2
Use break-inside to discourage splitting an element
break-inside expresses whether a break should be avoided within an element. It is useful for short callouts, cards, or other units whose meaning depends on appearing together:
@media print {
.callout {
break-inside: avoid;
}
}
This is a preference, not an unconditional guarantee. If an element is taller than the available page area, or content cannot fit under the requested restrictions, the pagination algorithm may need to relax constraints and find other break opportunities. CSS 2.2 describes this constraint-relaxing behavior in its treatment of page breaks and line groups: Paged media, CSS 2.2. Avoid applying break-inside: avoid indiscriminately to large containers, since it can leave the renderer with too few workable places to paginate.
How declarations at a boundary interact
At a potential break between two boxes, the relevant declarations include the preceding box’s break-after, the following box’s break-before, and the containing box’s break-inside. A forced value such as page requests a break in its context. An avoid value discourages a break, but does not override a forced break.
When more than one forced value applies at the same boundary, the value on the element later in the document flow wins. In practical terms, break-before takes precedence over break-after, which takes precedence over break-inside. This is why a parent’s avoid rule cannot cancel a forced break requested by a child or adjacent element. MDN describes this precedence in its break-before reference.
Rank #3
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
When troubleshooting an unexpected page boundary, inspect both neighboring elements and their container. A rule on only the element that visually appears to be “breaking” may not be the declaration that controls that particular boundary.
Keep paragraph line groups with orphans and widows
orphans sets the minimum number of lines from a block that should remain at the bottom of a page. widows sets the minimum number of lines from that block that should appear at the top of the next page. Under the CSS 2.2 definitions, both have an initial value of 2. These settings concern paragraph lines, not whole elements; they complement rather than replace break-inside.
@media print {
p {
orphans: 2;
widows: 2;
}
}
For instance, when a paragraph would otherwise leave a single line at the foot of a page, an orphan constraint can encourage the renderer to move more of the paragraph to the next page. A widow constraint can discourage leaving only a single line at the top of that next page. The renderer still has to paginate when the content and constraints cannot all fit, so do not treat line counts as a promise that a paragraph will never split awkwardly. The definitions and initial values are in the CSS 2.2 paged media specification.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Combine the rules in a print stylesheet
This illustrative pattern starts each major chapter on a new page, discourages splitting callouts, and asks for at least two paragraph lines on each side of a page split:
Rank #4
@media print {
.chapter { break-before: page; }
.callout { break-inside: avoid; }
p { orphans: 2; widows: 2; }
}
Adjust the selectors to the structure of your document. For example, if your callout selector also matches a long article section, the avoid rule may be counterproductive because the section may not fit on a page. Prefer targeting the smallest meaningful unit that should stay together. Inspect print preview or the generated PDF in the browser and renderer you intend to support; these examples express CSS requests, not a tested cross-browser output guarantee.
Legacy page-break properties
Older stylesheets may use page-break-before, page-break-after, and page-break-inside. The modern break-* names are the general properties for fragmentation contexts. MDN documents page-break-before as an alias of break-before; the legacy value always maps to page, since it meant a page break rather than a column break. See MDN’s break-before reference.
If you are maintaining older code, understand the legacy declaration’s intended meaning before changing it. In new print CSS, prefer the modern names and explicit values such as page or avoid, so the requested context is clear.
Compatibility and what to verify
MDN marks break-before as widely available across browsers since January 2019, while noting that support varies for some parts of the feature. That broad availability statement is not a guarantee that every value behaves identically in every browser or PDF renderer. The referenced MDN syntax follows the latest standard it cites, CSS Fragmentation Module Level 4; its fragmentation guide identifies CSS Fragmentation Module Level 3. CSS 2.2 remains useful for the older page-break and widow/orphan definitions, but is not the latest fragmentation specification.
Best Value
There is no browser-by-browser value matrix here. If your publication depends on a specific value, test the exact browser, operating system, print settings, and PDF workflow your readers or pipeline use. Check the actual page boundaries, rather than relying on the declaration alone.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Check pagination in print preview or a PDF
- Add the rules inside
@media printso they target print output rather than ordinary screen layout. - Open the page in the browser or renderer used for the intended output and open its print preview or PDF output.
- Check the boundary before and after the affected elements, then inspect the containing element for an
avoidrule that may interact with forced breaks. - Change one rule at a time and re-render. Confirm that the resulting pages still contain all content and that no oversized unit has been pushed into an unsuitable layout.
These checks are especially important when page size, margins, content length, or print settings change, because each can alter the available space and therefore the viable break opportunities.
Troubleshooting common page-break problems
A chapter does not begin on a new page
- Confirm the chapter selector matches the element that should start on the new page.
- Confirm the rule is active in print media, not only in a screen stylesheet or a different media query.
- Check the actual print/PDF output and the renderer’s support for the value you use; broad support for the property does not establish identical support for every value.
A callout still splits across pages
- Check that
break-inside: avoidapplies to the callout box containing the content you intend to keep together. - Check whether the callout is too tall for the available page area. Avoid is not a guarantee when content cannot fit under the requested constraints.
- Consider whether a smaller internal unit is the meaningful item to keep together rather than forcing a large section to avoid all breaks.
A break appears despite an avoid declaration
- Look for a forced
break-beforeorbreak-afterat the same boundary. Forced values take precedence over avoid values. - Inspect the preceding element, following element, and their containing element; all three positions can contribute declarations to the boundary decision.
A paragraph has an isolated line at a page edge
- Check that
orphansandwidowsare set on the paragraph or relevant block in the print stylesheet. - Remember that these properties govern minimum line groups at page boundaries, not whether an entire paragraph stays on one page.
- If the content cannot satisfy all constraints, the renderer may need to relax them to paginate.
Old CSS uses page-break-before: always
- MDN documents the legacy property as an alias and maps
alwaystopage. - When modernizing, use
break-before: pagewhen that is the intended meaning, then inspect the generated output in the target renderer.
Or skip the browser setup
If your goal is to capture a rendered page rather than tune its printed pagination manually, ScreenshotNeo offers a one-request screenshot or PDF API. For CSS page-break work specifically, use the browser’s print preview or PDF renderer to inspect page boundaries; a screenshot is useful for capturing a rendered page, but it does not replace checking paginated output. ScreenshotNeo accepts a URL and returns an image or PDF, and its clean-shot steps can be turned off individually.
cURL example for a screenshot of a page:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Sign up for ScreenshotNeo’s free plan to try it with no card.
Frequently Asked Questions
What is the difference between break-before and break-after?
They act on opposite sides of an element: break-before applies before its box, while break-after applies after it.
Do orphans and widows keep a paragraph on one page?
No. They set minimum paragraph-line groups at the bottom and top of adjacent pages; they do not keep the whole paragraph together.
Free tools Windows power users keep installed
One-click scans. No signup required.
Is page-break-before: always still usable?
MDN documents page-break-before as an alias of break-before, with the legacy value always mapping to page.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

