CSS page-break-after Property
The CSS page-break-after property controls whether a page break should occur immediately after an element when a document is printed.
It is a legacy CSS property retained for compatibility with older browsers and print engines. Modern CSS uses break-after to control page, column, and region breaks, but page-break-after remains useful when supporting existing print stylesheets.
page-break-after Syntax
The page-break-after property accepts keywords that allow, prevent, or force a page break after an element.
Basic Syntax
selector {
page-break-after: always;
}
This requests a page break immediately after the selected element when the document is printed.
Available Values
.section {
page-break-after: auto;
}
.section {
page-break-after: always;
}
.section {
page-break-after: avoid;
}
.section {
page-break-after: left;
}
.section {
page-break-after: right;
}
The left and right values are intended for documents that distinguish left-hand and right-hand pages.
CSS-Wide Keywords
.section {
page-break-after: initial;
}
.section {
page-break-after: inherit;
}
.section {
page-break-after: unset;
}
.section {
page-break-after: revert;
}
.section {
page-break-after: revert-layer;
}
CSS-wide keywords must be used individually and cannot be combined with other values in the same declaration.
Property Values
| Value | Description |
|---|---|
auto |
Allows the browser to determine whether a page break is needed after the element. |
always |
Forces a page break after the element in paged media. |
avoid |
Requests that a page break not occur immediately after the element. |
left |
Forces a break so the following content begins on a left-hand page. |
right |
Forces a break so the following content begins on a right-hand page. |
initial |
Resets the property to its initial value of auto. |
inherit |
Uses the computed value from the parent element. |
unset |
Resets the property to auto because it is not inherited. |
revert |
Reverts the property according to CSS cascade origin rules. |
revert-layer |
Reverts the property according to CSS cascade layer rules. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | auto |
| Inherited | No |
| Applies to | Block-level elements in normal flow within paged media |
| Computed value | As specified |
| Animation type | Discrete |
| Percentages | Not applicable |
| Primary use | Printed and paginated documents |
| Modern replacement | break-after |
| Status | Legacy compatibility property |
Valid Values
.chapter {
page-break-after: always;
}
.heading {
page-break-after: avoid;
}
.section {
page-break-after: auto;
}
.appendix {
page-break-after: right;
}
Invalid Values
.section {
page-break-after: 20px;
}
.section {
page-break-after: 50%;
}
.section {
page-break-after: none;
}
.section {
page-break-after: page;
}
Lengths, percentages, none, and the modern page keyword are not valid values for page-break-after. Use break-after: page for the modern equivalent of page-break-after: always.
How It Works
When a browser prepares a document for printing, it divides the content into page-sized areas. The page-break-after property influences whether a page boundary may or must occur after an element.
Automatic Page Breaks
.section {
page-break-after: auto;
}
The browser can insert a page break when necessary to fit the document onto the available pages.
Forced Page Breaks
.chapter {
page-break-after: always;
}
The next content begins on a new page, subject to the rules of paged layout and browser support.
Discouraging Page Breaks
.section-heading {
page-break-after: avoid;
}
This requests that the browser keep the heading together with the content that follows it.
Page Breaks and Document Flow
A page break changes where content appears in the printed document. It does not remove the content or change its order in the HTML source.
Important Limitation
Break avoidance is not an absolute guarantee. If content cannot fit within the available page area, the browser may need to break the document despite an avoidance request.
Forced Page Breaks
The always value is commonly used to separate chapters, reports, or other major document sections.
Starting the Next Section on a New Page
.report-section {
page-break-after: always;
}
Each report section using this rule requests a page break after its content.
Chapter Example
<section class="chapter">
<h2>Chapter One</h2>
<p>Chapter content goes here.</p>
</section>
<section class="chapter">
<h2>Chapter Two</h2>
<p>The next chapter starts on a new page.</p>
</section>
@media print {
.chapter {
page-break-after: always;
}
.chapter:last-child {
page-break-after: auto;
}
}
The first chapter requests a page break before the second chapter. The final chapter does not request an additional break after its content.
Avoiding an Unnecessary Final Break
@media print {
.print-section {
page-break-after: always;
}
.print-section:last-child {
page-break-after: auto;
}
}
This pattern avoids explicitly requesting a page break after the final section. Whether a trailing break creates a blank page can vary by print engine.
When to Use Forced Breaks
Forced page breaks are useful when a printed document requires clear divisions between major sections. Avoid placing them after every small content block because this can produce unnecessary pages.
Left and Right Pages
The left and right values are designed for paged documents that distinguish left-hand and right-hand pages, such as books and manuals.
Starting on a Right-Hand Page
.chapter-end {
page-break-after: right;
}
The following content is requested to begin on a right-hand page.
Starting on a Left-Hand Page
.section-end {
page-break-after: left;
}
The following content is requested to begin on a left-hand page.
Blank Pages
In a two-sided paged layout, satisfying a left-hand or right-hand page request may require inserting a blank page.
Modern Equivalents
.chapter-end {
break-after: right;
}
.section-end {
break-after: left;
}
The modern break-after property supports these page-side values.
Browser Limitations
Not all browser print engines fully support left-hand and right-hand page selection. Some may treat these values similarly to a regular forced page break.
Avoiding Page Breaks
The avoid value requests that the browser avoid inserting a page break immediately after the selected element.
Keeping Headings With Content
@media print {
h2,
h3 {
page-break-after: avoid;
}
}
This helps prevent headings from appearing alone at the bottom of a printed page.
Keeping Captions With Following Content
@media print {
.table-heading {
page-break-after: avoid;
}
}
The browser is asked to keep the table heading with the content that follows it.
Avoiding Breaks Inside Elements
@media print {
.report-card {
page-break-inside: avoid;
}
}
The separate page-break-inside property requests that an element not be divided across pages.
Combining Break Controls
@media print {
.section-heading {
page-break-after: avoid;
}
.content-card {
page-break-inside: avoid;
}
}
These rules request that headings remain with following content and that individual cards remain intact when possible.
Important Consideration
Browsers may override avoidance rules when necessary to paginate content. Avoidance works best with content that can reasonably fit on a single page.
Modern Alternative: break-after
The page-break-after property is deprecated in favor of break-after, which provides a broader fragmentation model.
Legacy Syntax
.chapter {
page-break-after: always;
}
Modern Syntax
.chapter {
break-after: page;
}
Both declarations request a page break after the element in paged media.
Value Comparison
| page-break-after | break-after |
|---|---|
auto |
auto |
always |
page |
avoid |
avoid-page |
left |
left |
right |
right |
The modern property also supports values for other fragmentation contexts, including multicolumn layouts.
Compatibility Pattern
@media print {
.chapter {
page-break-after: always;
break-after: page;
}
}
The legacy declaration provides compatibility with older print engines. The modern declaration follows it for browsers supporting break-after.
Avoiding Page Breaks With Modern CSS
@media print {
h2 {
page-break-after: avoid;
break-after: avoid-page;
}
}
This requests that a heading remain with the following content while supporting both legacy and modern syntax.
Important Distinction
The legacy always value maps to break-after: page for page-breaking behavior. The modern break-after: always value has broader fragmentation semantics and is not the direct compatibility equivalent.
Using page-break-after With Print Media
Page-break rules are generally placed inside an @media print block so they apply specifically to printed output.
Print-Specific Page Breaks
@media print {
.chapter {
page-break-after: always;
}
}
This keeps the page-break rule separate from the document's ordinary screen layout.
Combining With @page
@page {
size: A4;
margin: 20mm;
}
@media print {
.chapter {
page-break-after: always;
}
}
The @page rule requests page dimensions and margins, while page-break-after controls where new pages begin.
Screen and Print Styles
.chapter {
padding: 20px;
border: 1px solid #cbd5e1;
}
@media print {
.chapter {
padding: 0;
border: 0;
page-break-after: always;
}
}
The section retains its styled appearance on screen while using simplified formatting and page breaks when printed.
Print Preview
Use the browser's Print Preview feature to inspect page breaks before printing or saving the document as a PDF.
Printer and Browser Settings
Paper size, margins, scaling, and browser print behavior can affect pagination. Test the document using the intended print settings.
page-break-after Example
The following example demonstrates how to request a new printed page after each report section, except the last.
HTML Example
<div class="print-report">
<section class="report-section">
<h2>Introduction</h2>
<p>This section introduces the report.</p>
</section>
<section class="report-section">
<h2>Project Details</h2>
<p>This section contains the project information.</p>
</section>
<section class="report-section">
<h2>Conclusion</h2>
<p>This section summarizes the report.</p>
</section>
</div>
CSS Example
.print-report {
display: grid;
gap: 15px;
}
.report-section {
padding: 20px;
border: 2px solid #2563eb;
background-color: #dbeafe;
}
.report-section h2 {
margin: 0 0 10px;
}
.report-section p {
margin: 0;
}
@media print {
.print-report {
display: block;
}
.report-section {
padding: 0;
border: 0;
background: transparent;
page-break-after: always;
break-after: page;
}
.report-section:last-child {
page-break-after: auto;
break-after: auto;
}
}
Screen Preview
The following preview shows the report sections as they appear on screen. Page breaks are applied when printing and are not represented by the spaces between these boxes.
Introduction
This section introduces the report.
Project Details
This section contains the project information.
Conclusion
This section summarizes the report.
Expected Print Behavior
| Section | Requested Behavior |
|---|---|
| Introduction | Start the next section on a new page. |
| Project Details | Start the conclusion on a new page. |
| Conclusion | Do not request an additional page break afterward. |
In a browser that honors these rules, each section begins on a separate printed page. The exact output depends on the print engine and available page area.
Practical Report Example
@media print {
.report-chapter {
page-break-after: always;
break-after: page;
}
.report-chapter:last-child {
page-break-after: auto;
break-after: auto;
}
.report-chapter h2 {
page-break-after: avoid;
break-after: avoid-page;
}
}
This separates report chapters while requesting that headings remain with their following content.
Accessibility Considerations
Page breaks affect the printed presentation of a document but do not change its semantic HTML structure.
Preserve Logical Reading Order
Keep content in a meaningful source order. Forced page breaks should separate related sections without making the document difficult to follow.
Keep Headings With Content
@media print {
h2,
h3 {
page-break-after: avoid;
break-after: avoid-page;
}
}
This helps prevent headings from appearing at the bottom of one page while their content begins on the next.
Avoid Excessive Blank Pages
Use forced breaks only where they improve document organization. Unnecessary page breaks can make printed material harder to navigate.
Maintain Readable Print Layouts
Test the printed document for clipped text, separated captions, broken tables, and excessive whitespace.
Consider PDF Accessibility
Page breaks do not automatically create accessible PDF structure. Accessibility depends on the source document and the capabilities of the PDF generation process.
Important Consideration
Use semantic headings, meaningful document structure, and appropriate break controls together to create readable printed content.
Common Mistakes
Using the Modern page Value
.chapter {
page-break-after: page;
}
The page value belongs to the modern break-after property. Use page-break-after: always or break-after: page.
Using none Instead of auto
.section {
page-break-after: none;
}
The none keyword is invalid. Use auto to allow normal pagination.
Using Length or Percentage Values
.section {
page-break-after: 20px;
}
The property accepts page-break keywords, not spacing values.
Expecting Screen Layout Changes
Page breaks affect paged media. They do not create visible page boundaries in a normal scrolling webpage.
Applying Breaks to Every Element
Forced breaks after small content blocks can create unnecessary pages and excessive whitespace.
Forgetting the Final Section
A forced break after the final section is usually unnecessary. Consider resetting the property for the last section.
Assuming avoid Is Guaranteed
The browser may override break avoidance when content cannot fit within the available page area.
Ignoring Modern CSS
The legacy property remains useful for compatibility, but new print stylesheets should also consider break-after.
Confusing Break Before and Break After
page-break-after controls a break following an element. page-break-before controls a break preceding an element.
Important Considerations
Keep the following points in mind when using page-break-after:
- It controls page breaks after elements in paged media.
- It is a legacy property retained for compatibility.
- The modern replacement is
break-after. - Its initial value is
auto. - The property is not inherited.
- The
alwaysvalue forces a page break. - The
avoidvalue requests that a break not occur after the element. - The
leftvalue requests that following content begin on a left-hand page. - The
rightvalue requests that following content begin on a right-hand page. - Left-hand and right-hand page requests may require blank pages.
- Browser support for page-side selection varies.
- The
pagekeyword is not valid for the legacy property. - The
nonekeyword is invalid. - Lengths and percentages are not accepted.
- The modern equivalent of
page-break-after: alwaysisbreak-after: page. - Legacy and modern declarations can be combined for compatibility.
- Page-break rules are commonly placed inside
@media print. - The
@pageat-rule controls page dimensions and margins. - The
pageproperty assigns content to named page types. - Break avoidance is not guaranteed when content cannot fit.
- Forced breaks should be used sparingly to avoid unnecessary pages.
- The last section often does not need a forced break afterward.
- Page breaks do not change the semantic structure of HTML.
- Print Preview should be used to verify the final pagination.
Browser Support
The CSS page-break-after property is Widely available in modern browsers, including Chrome, Edge, Firefox, and Safari. It has been supported for many years as part of CSS paged-media styling.
The property is deprecated in favor of break-after. Although legacy support remains broad, browsers may differ in their handling of forced breaks, avoidance rules, and left-hand or right-hand pages.
For current compatibility information, visit Can I Use? and search for page-break-after.
Specifications
The legacy page-break-after property originates from CSS Level 2 and is maintained through compatibility requirements in modern CSS fragmentation specifications.
CSS Fragmentation Module Level 3
The specification describes how legacy page-break properties map to modern fragmentation properties.
For additional documentation and examples, consult MDN Web Docs.
