Error Codes Wiki

Browser Print Preview Errors — CSS Print Styles and Page Layout Issues

Informationalgeneral

About Browser Print Preview Errors

Fix browser print preview issues including broken layouts, missing content, incorrect page breaks, and CSS print media query failures. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: Print preview uses the @media print CSS rules to format content for printing. Elements hidden in screen view may need to be shown for print, and vice versa. Page breaks can be controlled with CSS break-before, break-after, and break-inside properties. Background colors and images are not printed by default — browser settings must enable them. Print preview layout differs between Chrome, Firefox, and Safari. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: No @media print CSS rules — screen layout applied directly to print. JavaScript-dependent content not rendered in print preview. Background colors and images disabled in browser print settings. Elements with overflow: hidden clipping content that should be visible on paper. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Add print styles: @media print { .no-print { display: none; } .print-only { display: block; } }. Control page breaks: .avoid-break { break-inside: avoid; } .page-break { break-before: page; }. Enable backgrounds: in print dialog, check 'Background graphics' option. Test with browser DevTools: Chrome DevTools > three dots > More tools > Rendering > Emulate CSS media type > print. For wide tables: @media print { table { font-size: 10px; } } to fit content on the page. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our Browser Errors collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

Why do background colors not print?

Browsers disable background printing by default to save ink. Users must enable 'Background graphics' in the print dialog. You can hint with -webkit-print-color-adjust: exact; but the user setting takes precedence.

Overview

Fix browser print preview issues including broken layouts, missing content, incorrect page breaks, and CSS print media query failures.

Key Details

  • Print preview uses the @media print CSS rules to format content for printing
  • Elements hidden in screen view may need to be shown for print, and vice versa
  • Page breaks can be controlled with CSS break-before, break-after, and break-inside properties
  • Background colors and images are not printed by default — browser settings must enable them
  • Print preview layout differs between Chrome, Firefox, and Safari

Common Causes

  • No @media print CSS rules — screen layout applied directly to print
  • JavaScript-dependent content not rendered in print preview
  • Background colors and images disabled in browser print settings
  • Elements with overflow: hidden clipping content that should be visible on paper

Steps

  1. 1Add print styles: @media print { .no-print { display: none; } .print-only { display: block; } }
  2. 2Control page breaks: .avoid-break { break-inside: avoid; } .page-break { break-before: page; }
  3. 3Enable backgrounds: in print dialog, check 'Background graphics' option
  4. 4Test with browser DevTools: Chrome DevTools > three dots > More tools > Rendering > Emulate CSS media type > print
  5. 5For wide tables: @media print { table { font-size: 10px; } } to fit content on the page

Tags

printcss-printpage-breakprint-previewlayout

More in General

Frequently Asked Questions

Browsers disable background printing by default to save ink. Users must enable 'Background graphics' in the print dialog. You can hint with -webkit-print-color-adjust: exact; but the user setting takes precedence.