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

The reliable way to make an HTML page print-friendly is to keep its semantic content and add print-specific CSS. Put those rules in an @media print block or a separate stylesheet linked with media="print", use @page for paper geometry, express sensible break points with the CSS paged-media properties, and verify every important page in the browser’s print preview. CSS states your intent; the browser, printer, PDF engine, and the user’s print settings determine the final pages.

Choose where your print CSS lives

Both approaches produce print rules. Choose the one that makes your project easiest to maintain.

Approach Best when Trade-off
@media print in the existing stylesheet The screen and print versions share most selectors and your team wants one file to search. A large block can make a screen stylesheet harder to scan.
A separate print-only stylesheet Print has a distinct layout, or you want print rules isolated for designers and maintainers. Selectors and cascade interactions are split across files, so specificity still needs attention.

Separate stylesheet

Place this in the document’s <head>:

<link rel="stylesheet" href="print.css" media="print">

The browser downloads and applies the file when rendering for print or print preview. MDN’s printing guide documents this pattern, print events, and cascade behavior.

Existing stylesheet

@media print {
  /* print-only declarations */
}

This is convenient for a small site or a component library in which each component owns its print override.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0

Start with a semantic, printable document

Print CSS cannot recover information that your HTML never exposes. Use a meaningful structure such as header, nav, main, article, aside, figure, blockquote, and footer. Keep the title, author or date, body, captions, citations, invoice totals, and other information a reader needs offline. A navigation menu, share toolbar, modal trigger, or “buy now” control can disappear, but do not hide an interactive element if its label or data is the only place essential information appears.

A useful page skeleton is:

<body>
  <header class="site-header">...</header>
  <nav class="site-nav" aria-label="Primary">...</nav>
  <main id="content">
    <article>
      <h1>...</h1>
      <p class="byline">...</p>
      ...
    </article>
  </main>
  <footer class="site-footer">...</footer>
</body>

A practical print stylesheet

Use the following as a starting point, then adapt selectors to your markup and document type:

@media print {
  /* Establish a predictable paper-friendly baseline. */
  *, *::before, *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html {
    font-size: 11pt;
  }

  body {
    margin: 0;
    color: #000;
    background: #fff;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.45;
  }

  /* Remove controls and navigation that have no useful paper output. */
  .site-header,
  .site-nav,
  .site-footer,
  .toolbar,
  .share-buttons,
  button,
  [role="button"] {
    display: none !important;
  }

  main,
  article {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  /* Avoid wasting ink on decorative color while retaining readable contrast. */
  a {
    color: #000;
    text-decoration: underline;
  }

  /* Add destinations for links when the URL is useful on paper. */
  article a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 90%;
    overflow-wrap: anywhere;
  }

  img {
    max-width: 100% !important;
    height: auto;
  }

  figure,
  blockquote,
  pre,
  table {
    break-inside: avoid;
  }

  h1,
  h2,
  h3 {
    break-after: avoid;
  }

  p,
  li {
    orphans: 3;
    widows: 3;
  }

  pre,
  code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  table {
    width: 100%;
    border-collapse: collapse;
  }

  th,
  td {
    border: 1px solid #000;
    padding: 0.25rem;
  }
}

@page {
  margin: 1.5cm;
}

The sample removes common screen-only elements, lets content use the page width, prevents short blocks from splitting where practical, and keeps links and tables legible. Change the selectors rather than copying them blindly. A globally hidden footer, for example, may remove an invoice’s legal details that must remain in print.

Control page size, orientation, and margins with @page

The @page at-rule describes the page box used for paged output. You can set a named size, orientation, and margins:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
@page {
  size: A4 portrait;
  margin: 1.5cm 1.2cm 1.8cm;
}

/* A wide report can opt into a named landscape page. */
@page report-landscape {
  size: A4 landscape;
  margin: 1cm;
}

.report {
  page: report-landscape;
}

Use a paper size only when the document has a real requirement. A general article can usually leave the user’s paper choice alone and set modest margins. Support for portions of @page, named pages, and margin behavior varies by browser and output engine, so inspect the preview rather than assuming the declaration won.

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

Portrait or landscape?

  • Portrait: articles, letters, recipes, and most forms; it gives text a comfortable line length.
  • Landscape: genuinely wide tables, timelines, or dashboards; it can make ordinary paragraphs unnecessarily wide.

Do not solve a wide table by shrinking all body text. First remove nonessential columns, allow cells to wrap, or provide a print-specific table representation.

Express intentional page breaks

CSS paged media provides break-before, break-after, and break-inside for fragmentation. They express a preference, not an absolute promise: a block that is taller than a page cannot remain intact.

@media print {
  .chapter,
  .invoice-section {
    break-before: page;
  }

  .keep-with-next {
    break-after: avoid;
  }

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

  h2,
  h3 {
    break-after: avoid;
  }
}

Use a forced break for a new chapter, appendix, or invoice section—not after every heading. Keep “avoid” for short, self-contained units such as a figure with its caption. The CSS paged media guide explains printable areas, page geometry, and fragmentation.

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

Legacy properties

You may still encounter page-break-before, page-break-after, and page-break-inside. The break-* properties are the current model; retain a legacy declaration only when your supported browser set requires it, and test both.

Fix common screen-layout problems

Fixed widths and overflow

Screen layouts often use a fixed width, a large minimum width, or a horizontally scrolling wrapper. In print, override those constraints:

Rank #3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
  • CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
  • HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
  • FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
  • BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer
@media print {
  .layout,
  .content,
  .table-scroll {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: visible !important;
  }
}

If a table is still wider than the page, make columns wrap, shorten labels, or create a print-only table. Forcing a tiny scale produces unreadable output.

Color, backgrounds, and ink

Black text on a white background is a dependable baseline. Browsers and print dialogs may omit background colors and images unless the user enables background printing. CSS cannot reliably override that preference. If a colored panel conveys meaning, include a text label, border, icon, or other non-color cue.

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

Images, icons, and decorative assets

Constrain images to the printable width and preserve their aspect ratio. Hide purely decorative backgrounds; keep diagrams, logos, charts, and product photos that carry information. Give informative images meaningful alt text so the printed or extracted content still has context.

Headers, footers, and repeated table headings

Use normal document elements for content that must appear in the output. A browser may add its own URL, date, or page number through print-dialog settings; CSS should not assume it can replace those controls. For long tables, mark the header row as a table header and use:

@media print {
  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-footer-group;
  }
}

Actual repetition behavior differs across engines, so verify a multi-page table in the target browsers.

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
  • IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
  • IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
  • Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management

Make links, code, forms, and dynamic content useful on paper

Links

Underlining links preserves the visual cue. Printing absolute URLs after every link can make an article noisy; restrict the generated URL to the content area and to external links, as in the sample, or omit it for a document whose readers already have a companion URL list.

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

Code blocks

Allow code to wrap or provide a print-only alternate. Horizontal scrolling is useful on screen but hides content on paper. Keep a contrasting border and enough padding, and avoid splitting a short command across pages.

Forms and controls

Print the field label, current value, and validation message—not just an empty input box. For a read-only print view, you can replace an input’s visual appearance with a value element in the HTML. Do not hide a checkbox or select if its selected state is essential; style it so the state is understandable without relying on color.

Lazy-loaded and interactive content

Ensure content is present before the print preview is opened. Expand accordions that contain required text, render chart data in an accessible table or caption, and provide a non-JavaScript fallback for critical information. A print stylesheet changes presentation; it does not cause missing data to load.

Preview and test methodically

Print preview is mandatory. The MDN media-query reference describes print as a paged medium and shows how to inspect it. In a Chromium-based browser, open the browser menu and choose Print (or press Ctrl/Cmd+P), then inspect the preview before printing or choosing “Save to PDF.” Firefox and Safari expose equivalent print-preview dialogs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images
  1. Open the page at representative widths and with the content fully loaded.
  2. Open print preview and confirm the intended paper size, orientation, margins, scale, and background settings.
  3. Check the first page for a visible title, useful metadata, and no clipped content.
  4. Inspect headings at page bottoms, figures with captions, blockquotes, code, wide tables, links, and form values.
  5. Navigate every page for blank pages, unexpected forced breaks, orphaned headings, and text cut off at the right edge.
  6. Repeat with the main browsers and paper formats your audience actually uses.
  7. Save a PDF and open it independently; a PDF viewer can reveal font, link, and pagination problems that are easy to miss in the preview.

Test with the print-dialog options your readers control. Scaling, headers and footers, color, duplex printing, and background graphics may alter the result even when the CSS is unchanged.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the failures developers see most

Symptom Likely cause Fix
Navigation, buttons, or a cookie banner still appears The selector does not match, or a more-specific rule overrides the print rule. Inspect the print media in developer tools, target the actual class or attribute, and use !important sparingly for utility controls that must disappear.
Text is clipped or a second page is unexpectedly wide Fixed widths, transforms, or an overflowing flex/grid child. Reset width and minimum width, remove transforms, set overflow: visible, and make long words or code wrap.
Colors or background images are missing The user or browser disabled background printing. Do not depend on color alone; add borders and labels, and tell users when a background option is needed.
A heading is stranded at the bottom of a page No fragmentation rule keeps it with following content. Apply break-after: avoid to headings and check that the next block is not too tall to fit.
A figure or card splits in half The block is fragmentable or longer than the remaining space. Use break-inside: avoid for short blocks; accept a split when the content cannot fit on one page.
Links print without destinations The screen design communicates links only through color. Underline them and optionally append attr(href) for external content links.
Print preview shows blank pages A forced break, oversized element, or hidden element retaining layout space. Remove unnecessary break-before, reset dimensions and margins, and inspect overflow in print mode.
Rules work in one browser but not another Different support for paged-media features or print settings. Use a simple baseline, feature-detect where appropriate, and test the browsers and PDF engines you support.

Performance, reliability, and maintainability

  • Keep print CSS small and scoped. A separate file can avoid shipping print-only declarations in critical screen CSS, while an in-file block can reduce coordination overhead; choose based on your build and team.
  • Avoid JavaScript that rewrites the entire document on the beforeprint event. If a print-only DOM change is unavoidable, make it deterministic and restore the screen state on afterprint.
  • Use stable component classes rather than fragile selectors tied to deep markup.
  • Do not rely on a single browser’s PDF output as proof of printer compatibility. Print preview is an inspection step, not a conformance guarantee.
  • For invoices and regulated documents, keep a server-generated or otherwise controlled document format when exact pagination, fonts, and archival fidelity are requirements beyond CSS’s guarantees.

Or skip the browser setup

If your goal is to obtain a clean screenshot or PDF of the finished page rather than style the page for a human printer, ScreenshotNeo provides a website screenshot API and MCP server. It accepts a URL and can capture PNG, JPEG, WebP, or PDF. Before capture it accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. This is a capture service, not a replacement for print CSS when readers must print your HTML themselves.

One-call cURL example

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 documentation for response formats and options. The same endpoint supports full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper size/margins/orientation/page ranges, custom CSS and JavaScript, clicks before capture, selector hiding, waits for a selector/delay/network idle, request and resource blocking, custom headers/cookies/user agents/Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API, and an OpenAPI specification. Common screenshot-API parameter names also work, which can simplify migration.

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo also has an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Every feature is available on every plan: 1,000 shots per month are free with no card; paid plans start at $5 for 3,000 shots, followed by $15 for 15,000, $39 for 60,000, $99 for 250,000, and $249 for 1,000,000. Yearly billing gives two months free. Create a free ScreenshotNeo account to start with the 1,000 monthly shots.

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

Frequently Asked Questions

Can CSS force a user’s printer to use color or background graphics?

No. The browser’s print dialog and printer settings can suppress backgrounds, alter scaling, or change color output. Design the document so meaning survives without those options.

Should I use page-break-before or break-before?

Use the modern break-before, break-after, and break-inside properties. Add legacy declarations only if your supported browser set needs them, and verify the resulting pagination.

Why does break-inside: avoid not keep a long element together?

The rule is a preference. If the element is taller than the available page area, the browser must fragment it.

Is print CSS enough for pixel-identical PDFs?

No. CSS print output depends on the browser, PDF engine, fonts, paper settings, and user preferences. Use a controlled document-generation pipeline when exact pagination is a hard requirement.

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

Quick Recap

Bestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$184.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.