Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the modern CSS Fragmentation properties in your print stylesheet: break-before: page starts an element on a new PDF page, break-after: page ends a section with a forced break, and break-inside: avoid-page asks the renderer not to split a suitably sized block. These rules control pagination; they do not shrink content that is taller than the printable page.

The basic CSS

Put pagination rules inside a print media query so they affect PDF or print output without changing the screen layout.

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

  .keep-together {
    break-inside: avoid-page;
  }
}

Apply new-page to the block that should begin on the next page:

<section class="chapter">
  <h1>Chapter 1</h1>
  <p>...</p>
</section>

<section class="chapter new-page">
  <h1>Chapter 2</h1>
  <p>...</p>
</section>

The second section starts on a fresh page when the document is rendered in a paged print context. The target must generate a box in normal print flow; a property on an element with no generated box is ignored.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Choose the right break property

break-before: page

Use this when the semantic boundary belongs to the following element: a new chapter, invoice, report section or appendix. It is usually the clearest rule because the section carries its own pagination behavior.

break-after: page

Use this when the boundary belongs to the preceding block.

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

Do not put forced breaks on both adjacent elements while debugging. Redundant rules can produce blank pages or make it difficult to identify which declaration won.

break-inside: avoid-page

This is an avoidance preference, not a forced boundary and not an overflow repair. It is useful for a card, short table, figure-and-caption group or signature area that should remain intact.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
@media print {
  .summary-card,
  .figure-caption-group {
    break-inside: avoid-page;
  }
}

Choose a block that can actually fit in the printable area. If it is taller than a page, the renderer cannot keep it intact; the content must split or the layout must be redesigned. Applying avoidance to every large container can create poor pagination because the renderer has too few legal places to insert a soft break.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

How forced breaks are resolved

Pagination is decided at fragmentation boundaries. The renderer considers the preceding element’s break-after, the following element’s break-before, and the containing element’s break-inside. A forced break takes precedence over an avoid value. When two forced values meet, the later-in-flow property wins; in the common boundary between two siblings, that means the following element’s break-before takes precedence over the preceding element’s break-after.

These declarations only have an effect in a fragmentation context such as printing or PDF pagination. They do not create a visible gap in ordinary continuous screen layout. As Chrome’s LayoutNG documentation puts it, “For fragmentation to happen, the content needs to be inside a fragmentation context.”

Set page size and margins separately

Use @page for page geometry and the fragmentation properties for break placement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
@page {
  size: A4;
  margin: 18mm 16mm 20mm;
}

@media print {
  .new-page { break-before: page; }
  .keep-together { break-inside: avoid-page; }
}

You can substitute another supported size, such as Letter, or specify dimensions. Margins reduce the usable area, so a block that fits on screen may no longer fit on the printed page. Browser print dialogs can also override CSS page settings, depending on the selected destination and options.

Prevent common awkward splits

Keep a heading with its following content

A heading stranded at the bottom of a page is usually solved by keeping the heading and a short following group together, rather than forcing a page before every heading.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
@media print {
  .heading-group {
    break-inside: avoid-page;
  }
}
<div class="heading-group">
  <h2>Payment details</h2>
  <p>The explanatory paragraph is short enough to fit with the heading.</p>
</div>

Keep a figure and caption together

Wrap the image and caption in one reasonably sized block and apply break-inside: avoid-page. Do not apply it to an image larger than the printable area; resize the image or allow the group to split.

Handle tables carefully

Large tables generally need to continue across pages. Avoid applying break-inside: avoid-page to the entire table unless it is short enough to fit. If a table must be one unit, reduce its rows, font size or spacing instead of expecting the browser to compress it automatically. Header repetition and table pagination can vary by renderer, so validate the actual PDF pipeline.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Legacy properties

Older code commonly uses:

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

  .keep-together {
    page-break-inside: avoid;
  }
}

MDN documents page-break-before, page-break-after and page-break-inside as legacy aliases retained for compatibility. For new stylesheets, prefer break-before, break-after and break-inside. The legacy value always maps to the modern page-specific value, preserving its historical page-break meaning rather than introducing a column break.

A reliable debugging procedure

  1. Confirm print media is active. Put the rule inside @media print, then use print preview or your PDF command. A screen screenshot cannot prove that pagination rules are active.
  2. Inspect the selected element. Verify the class is present, the selector is not overridden later, and the element participates in normal print layout.
  3. Remove competing rules temporarily. Check the target’s break-before and break-after, its ancestors’ break-inside, and any inherited or higher-specificity declarations.
  4. Use one forced boundary. During diagnosis, keep either the following element’s break-before: page or the preceding element’s break-after: page, not both.
  5. Check page geometry. Inspect @page size and margins and the browser’s print settings. A margin, header, footer or scale setting can consume the space you expected to be available.
  6. Test the real runtime. Compare the generated PDF, not only a development preview. A browser preview and a server-side HTML-to-PDF engine may implement fragmentation differently.
  7. Reduce complex layouts. If the issue occurs inside flex, grid, table, positioned or transformed content, create a small reproduction with ordinary block elements. Add the complex layout back after the simple case paginates correctly.

Why a page break can appear to be ignored

The rule is in the wrong media context

A rule under @media screen, or a stylesheet not loaded by the PDF process, has no effect during printing. Confirm the generated document receives the print stylesheet.

The element has no usable box

Elements with display: none, an empty generated box or a layout state that removes them from normal flow cannot provide the intended boundary. Move the class to the visible block that owns the content.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Avoidance was mistaken for a force

break-inside: avoid-page only discourages an internal break. It does not start a new page. Use break-before: page or break-after: page for a mandatory boundary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The block is taller than a page

No break property can make an oversized block fit. Split the content into smaller sections, reduce its dimensions, or permit it to continue across pages.

The renderer has layout-specific limitations

Chromium’s implementation history is useful context: flex and grid fragmentation shipped in Chrome 103, table fragmentation in Chrome 106, and print pagination with LayoutNG block fragmentation in Chrome 108. Those milestones describe Chromium implementation work, not identical behavior across every browser, library or version.

Minimal complete example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Paged report</title>
  <style>
    @page {
      size: Letter;
      margin: 0.7in;
    }

    body {
      font: 11pt/1.45 system-ui, sans-serif;
    }

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

      .card {
        break-inside: avoid-page;
      }
    }
  </style>
</head>
<body>
  <section class="card">
    <h1>Summary</h1>
    <p>This short block should remain intact.</p>
  </section>

  <section class="page-start">
    <h1>Details</h1>
    <p>This section begins on a new page.</p>
  </section>
</body>
</html>
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to inspect the rendered result rather than maintain a PDF pipeline, ScreenshotNeo can return a screenshot or PDF from one request. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing result in X-Page-Verdict and X-Billed headers.

Use the API documentation at https://screenshotneo.com/docs/ for all options, including PDF paper size, margins, landscape mode and page ranges.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Further standards and implementation context

CSS Paged Media defines page setup such as size and margins, while CSS Fragmentation defines how content is divided across pages, columns and regions. The W3C CSS Fragmentation Module Level 3 is the standards reference. MDN’s fragmentation, break-before and break-after references document the property interactions and legacy aliases. Use those references alongside the documentation for the browser or PDF engine that actually produces your files.

Frequently Asked Questions

Can I force a break only in PDF output and not on paper?

CSS print media applies to both print preview and most PDF destinations. If you need different behavior for a particular export tool, use that tool’s print stylesheet or runtime-specific options.

Should I use break-before on a heading itself?

Use it on the block that semantically starts the new section. If the heading is wrapped with introductory content, put the class on that wrapper so the whole group moves together.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does a forced break work inside a flex or grid container?

Support depends on the browser or PDF engine and its version. If pagination is unreliable, reproduce the section with normal block layout, then reintroduce flex or grid while testing the generated PDF.

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.