How7o
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Reading: CSS Page Break for Printing: How to Split a Web Page Into Multiple Printed Pages
Share
How7oHow7o
Font ResizerAa
  • OS
Search
  • Home
  • Tools
  • Prank Screens
  • Learn
  • Blog
  • Contact
Follow US
© 2024–2026 How7o. All rights reserved.
How7o > Free Laravel, PHP, WordPress & Server Tutorials > Web Development > CSS Page Break for Printing: How to Split a Web Page Into Multiple Printed Pages
Web Development

CSS Page Break for Printing: How to Split a Web Page Into Multiple Printed Pages

how7o
By how7o
Last updated: February 6, 2026
6 Min Read
CSS page break for printing shown in a print preview layout
SHARE

I ran into this exact problem when I tried to print a web page for a client: everything came out on a single printed page, even though the content clearly needed to be split. If you’re searching for a CSS page break for printing, the fix is simple—you just need to tell the browser where a new printed page should start.

Contents
  • Why page breaks don’t happen automatically
  • The simplest solution: add a page-break element for printing
    • Step 1: Add a page-break marker in HTML
    • Step 2: Add print-only CSS
  • Modern CSS alternative: break-before / break-after (recommended)
  • Step-by-step: common ways to split printed pages
    • Option A: Force a break before a section
    • Option B: Force a break after a section
    • Option C: Prevent ugly splits inside a section
  • Troubleshooting: when CSS page breaks don’t work
  • Quick copy-paste snippet (most practical)
  • Official references
  • Related guides
  • Final notes

In this guide, I’ll show you the cleanest way to force page breaks when printing, using print-only CSS. I’ll also include modern CSS properties (the newer “break-*” rules) and a quick troubleshooting checklist for when the browser ignores your page breaks.

Why page breaks don’t happen automatically

When you print a website, the browser tries to fit everything continuously—like a long document—then it decides page boundaries on its own. That’s why your layout can look fine on screen but print as one long flow with awkward splits.

To split the print output into multiple pages, you add a “break point” in your HTML (or target an element) and apply print-specific CSS that forces a new printed page.

The simplest solution: add a page-break element for printing

The most reliable approach is to add a dedicated “page break” element in your markup wherever you want the next printed page to begin, and then apply the print CSS rule to it.

Step 1: Add a page-break marker in HTML

<!-- Page Break Marker -->
<div class="page-break"></div>

Place that div between sections—right where you want the next printed page to start.

Step 2: Add print-only CSS

@media print {
  .page-break {
    page-break-before: always;
  }
}

Now, when you print the page, anything after .page-break will start on a new printed page.

Modern CSS alternative: break-before / break-after (recommended)

Browsers still support page-break-before and page-break-after, but the modern standard is the break-* family. If you want the most future-friendly option, use these.

@media print {
  .page-break {
    break-before: page;
  }
}

You can also break after a specific element instead of adding an extra marker:

@media print {
  .section-end {
    break-after: page;
  }
}

This is handy if your HTML is structured in sections already (like invoices, reports, or long tutorials).

Step-by-step: common ways to split printed pages

Here are the patterns I use most often depending on the layout.

Option A: Force a break before a section

@media print {
  .print-new-page {
    break-before: page;
  }
}

Use it like this:

<div class="print-new-page">
  <h2>Page 2 begins here</h2>
  ...
</div>

Option B: Force a break after a section

@media print {
  .print-break-after {
    break-after: page;
  }
}

Great for “one section per page” layouts.

Option C: Prevent ugly splits inside a section

Sometimes the issue isn’t adding a page break—it’s that the browser breaks in the middle of a table, a card, or a block of content. To reduce that, use break-inside (or the older page-break-inside).

@media print {
  .no-break {
    break-inside: avoid;
    page-break-inside: avoid; /* older fallback */
  }
}

Apply .no-break to things like receipts, cards, or important blocks you don’t want split across pages.

Troubleshooting: when CSS page breaks don’t work

If your CSS page break for printing is being ignored, it’s usually one of these reasons:

  • You didn’t wrap it in print media: Make sure your rules are inside @media print { ... } so they apply only to printing.
  • The element is hidden in print: If you have print rules like display:none on parents, your break marker may never exist in the print layout.
  • Flex/Grid layouts can be tricky: Some browsers struggle with page breaks inside complex flex or grid containers. Try applying the break to a parent block or simplifying the print layout.
  • Tables may break unexpectedly: Use break-inside: avoid where possible, or print-friendly table styling.
  • Margins/headers/footers affect pagination: Browser print settings (like margins) change where pages cut off. Test with default settings first.

Quick copy-paste snippet (most practical)

If you just want a practical solution you can drop in quickly, this combo works well:

<!-- Put this wherever you want a new printed page -->
<div class="page-break"></div>

<style>
@media print {
  .page-break { 
    break-before: page;
  }
}
</style>

Note: Page breaks won’t show visually on the screen (and that’s normal). They only affect printing.

Official references

  • MDN: break-before
  • MDN: page-break-before

Related guides

(Add your internal links here when you have them.)

  • How to create a print-friendly CSS stylesheet in WordPress
  • How to print a specific section of a web page
  • How to stop tables from breaking across printed pages

Final notes

Once I started using a dedicated print stylesheet and adding intentional break points, printing web pages became predictable. Start with break-before: page inside @media print, and use break-inside: avoid to keep important blocks from splitting awkwardly.

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
[mc4wp_form]
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article get .env variable in Laravel using env and config How to Get .env Variables in Laravel (Controller + Blade) Safely
Next Article Capitalize all words in JavaScript with a ucwords-style function Capitalize All Words in JavaScript (ucwords Equivalent) + First Letter Uppercase
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

FacebookLike
XFollow
PinterestPin
InstagramFollow
Most Popular
Bun runtime — faster JS toolkit replacing npm in Laravel projects
How to Install Bun Runtime on Ubuntu (And Use It in a Laravel Project)
May 24, 2026
Tailscale mesh — peer-to-peer connections between devices, coordination server
How to Install Tailscale on Ubuntu (Zero-Config Mesh VPN for Self-Hosters)
May 24, 2026
Caddy server — automatic HTTPS, 3-line Caddyfile vs 25-line nginx config
How to Install Caddy Server on Ubuntu (Automatic HTTPS, Drop-in nginx Alternative)
May 24, 2026
Cloudflare Tunnel — outbound-only connection from server, no inbound port forward
How to Install Cloudflare Tunnel on Ubuntu (Expose Local Services, No Port Forwarding)
May 24, 2026
WireGuard encrypted tunnel between server and clients with lock icons
How to Set Up WireGuard VPN on Ubuntu (Server, Linux Client, and iOS)
May 24, 2026

You Might Also Like

WordPress logged-in menu swap — register_nav_menus + wp_nav_menu with is_user_logged_in ternary
Web Development

How to Display Different Menus to Logged-In Users in WordPress

7 Min Read
PHP Bangladeshi number format — 1,00,23,456.79 grouping
Web Development

Format Numbers in Bangladeshi / Indian Style with PHP

6 Min Read
Laravel foreign key constraint linking posts.user_id to users.id in a schema diagram
Web Development

How to Add Foreign Keys in Laravel Migration

6 Min Read
Get N elements from a JavaScript array with slice for pagination
Web Development

How to Get N Elements from an Array in JavaScript

5 Min Read
How7o

We provide tips, tricks, and advice for improving websites and doing better search.

Tools

  • Age Calculator
  • Word Counter
  • Image Upscaler
  • Password Generator
  • QR Code Generator
  • See all tools→

Pranks

  • Fake Blue Screen Prank
  • Hacker Typer
  • Fake iMessage Generator
  • Windows XP Crash Prank
  • Windows 11 Update Prank
  • See all prank screens →

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service
  • Sitemap
© 2024–2026 How7o. All rights reserved.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?