← All tools

CSS Print Stylesheet Generator

Generate print-only CSS for page size, margins, fonts, visibility and printed link addresses.

css-print-stylesheet-generatorLOCAL WORKSPACE

Enabling local controls…

Settings

Hide elements
Links
Page setup

Results

Add the CSS to your project, then check browser print preview. Printer and user settings can override paper, margins and color.

CSS

@media print {
  @page { size: A4 portrait; margin: 2cm; }
  * { print-color-adjust: exact; }
  body { font-family: serif; font-size: 12pt; color: #000; background: #fff; }
  nav, header nav { display: none !important; }
  aside, .sidebar, [role="complementary"] { display: none !important; }
  video, iframe, embed { display: none !important; }
  .ad, .ads, .advertisement, [data-ad] { display: none !important; }
  a[href^="http://" i]::after, a[href^="https://" i]::after { content: " (" attr(href) ")"; font-size: 0.8em; overflow-wrap: anywhere; }
  h1, h2, h3, h4, h5, h6 { break-after: avoid-page; }
  pre, blockquote, table { break-inside: avoid-page; }
}
Download CSS

How to use this tool

Choose a preset or edit the controls. Copy the result or download it when it is ready.

When not to use it

Check browser print preview and printer settings before sharing.