THE GITHTML FIELD GUIDE

Find styles accidentally restricted to print media

If styling appears in print preview but not on screen, inspect media attributes and @media conditions before rewriting the CSS. Rules inside print-only conditions are intentionally excluded from normal screen rendering. Keep shared reading styles outside those conditions and reserve print blocks for changes that genuinely depend on paged output.

Identify the specific failure

A stylesheet link can be limited to print, and individual rules can be nested inside a print media block. Both can make correct selectors appear ineffective in the ordinary document. The inverse mistake can also hide content in print while screen reading looks fine.

Make a narrow correction

Identify the rule responsible for one visible difference and inspect its enclosing conditions. Move shared typography or spacing into the baseline stylesheet. Keep page-break controls and print-specific navigation removal scoped to print rather than duplicating the entire theme.

  1. Check the stylesheet link's media attribute and enclosing @media blocks.
  2. Separate shared reading styles from genuinely print-specific changes.
  3. Verify both modes after moving rules because their cascade order may change.
text
body { line-height: 1.6; }
@media print { nav { display: none; } }

Compare one property across screen and print contexts

Suppose a report's body text is readable in print preview but cramped in the normal browser view. Inspect the line-height declaration that produces the comfortable print result. It may live in a stylesheet linked with media="print", or inside a print block in a shared stylesheet. Move only the genuinely shared typography into the baseline. Do not move the whole print block, because it may also hide navigation, remove backgrounds, or impose page-oriented dimensions that are inappropriate for screen reading.

Media conditions can combine a media type with width or other features. A rule intended for a narrow screen may accidentally require print as well, and therefore never match during ordinary reading. Check the complete condition rather than recognizing one familiar min-width or max-width fragment and assuming it applies. In developer tools that can emulate media, verify which mode is currently selected; a leftover print emulation setting can make a desktop preview appear inconsistent with the actual browser window.

Use a small comparison record with the paragraph's font size, line height, width, and visibility in each mode. Then inspect a figure and a navigation link, because print and screen often legitimately differ for those elements. The goal is not identical rendering. It is an intentional division: shared content and readable typography in both contexts, with paper-specific pagination and screen-specific navigation where appropriate. Check that information hidden for printing is truly optional, especially explanatory labels or caveats that may share a class with a toolbar.

Verify the repaired artifact

Compare the same paragraph and figure in screen view and print preview. Each mode should be understandable without borrowing missing information from the other.

Sources and further reading

AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.

All html troubleshooting guides →

Read as MarkdownAll guides

Find styles accidentally restricted to print media · gitHtml