Websites Should Be Printable
TL;DR: On 24 October 2026, developer Brennen Puth published a short post titled “Websites Should Be Printable” after discovering that his own site printed badly: text two sizes too large, a header that looked broken, and links that turned pale grey in black and white. About 40 lines of @media print CSS fixed it well enough that he shipped the snippet publicly. The Hacker News thread that followed, 393 points and 211 comments, turned into a referendum on something most developers have quietly abandoned: the idea that a page you cannot print is a page you cannot keep.
What actually happened when a developer printed his own site
Puth’s argument is not a design manifesto. It starts from a personal habit: he reads a lot of printed papers, and marking up a printed document engages him better than scrolling. That led to a simple question about his own writing, which is how most real web problems start. He hit Ctrl-P on his own blog and expected a decent result.
It was not decent. In his words, the text came out too big by about two levels, the header looked awful, and his links looked “awfully gray in black-and-white” once the printer discarded colour. Everything was technically visible, which is the trap. A page can contain all the content and still be unusable as a document.
The post went up on 24 October 2026 and reached the Hacker News front page two days later, submitted by user bagatelle, where it collected 393 points and 211 comments before the thread cooled. Puth added an edit on 26 October noting that feedback from Lobsters and Hacker News had already changed his approach and that he was simplifying the stylesheet. The final snippet is smaller than the first version, and that is the honest shape of this problem: the first fix is always too big.
Why did such a small post travel so far? Because almost everyone who tried it found the same thing on their own site. The comments are full of people discovering that their print output was never designed at all. It is whatever the browser guessed from a layout built for a 1440-pixel window.
Why printable websites keep breaking, fifteen years after print CSS shipped
The tooling has existed since the CSS 2.1 era. @media print is not experimental, @page is in the CSS Paged Media Module Level 3, and every browser has a print pipeline. Nothing here is unsolved research. What changed is the default path of web development.
Modern sites are built mobile-first, rendered by JavaScript frameworks, and styled with viewport-relative units. A hero section at min-height: 100vh looks confident on a phone and absurd on A4. A sticky navigation bar is helpful on screen and becomes a floating slab across the top of page one. Link colours chosen against a white background become unreadable the moment the printer decides grey is expensive.
Then there is the content problem. A page whose body arrives from a client-side fetch, or that lives inside a scrollable container, does not print its content at all. One commenter on the thread tested a site whose main content sat inside height: 100vh with independently scrolling sub-sections, and the print job captured only what was visible in the window. That is not an ugly printout. That is a blank document with a logo.
The counter-argument appeared early and is worth taking seriously. One commenter argued the web was built to be navigable, not printable, and that LaTeX and PDF are the right tools for paper. The rebuttal is practical: nobody reformats a utility statement or a tenancy agreement into LaTeX before filing it. The document already exists as a web page. The print button is the only tool the reader has.
The CSS that makes a website printable
Puth’s published snippet is a good baseline because it is short enough to read in one sitting. It does four things: it hides screen-only chrome, it shows print-only elements, it resets the type scale into points, and it forces links to black so they survive a monochrome print.
.onlyPrint {
display: none;
}
@media print {
.noPrint {
display: none;
}
.onlyPrint {
display: inline;
}
p,
ol {
font-size: 12pt;
}
h3, h4 {
font-size: 13pt;
}
h2 {
font-size: 14pt;
}
h1 {
font-size: 16pt;
}
.giallo {
border: 3px solid black;
}
.giallo-l {
font-size: 11pt;
}
a {
color: black !important;
}
}
Two classes carry most of the weight. onlyPrint is hidden on screen and revealed on paper, which is how you tag a small author attribution or a “sourced from” line that would clutter the screen version. noPrint is the reverse, and it is the class you put on the header, the cookie banner, the newsletter pop-up, the share buttons and the related-posts carousel.
The .giallo rules are Puth’s code-block styling. He is candid that code blocks remain the ugliest part of his print output, because a code block wants to render as one unbroken chunk and refuse to cross a page boundary. He asked the thread for a solution, and the thread gave him one.
Here is the hardened version, which keeps his structure and adds the fixes the discussion produced:
@media print {
/* Page geometry: A4 with sane margins, no browser chrome */
@page {
size: A4;
margin: 18mm 16mm;
}
/* Reveal / hide */
.noPrint { display: none !important; }
.onlyPrint { display: inline; }
/* Type: points, and never smaller than the reader's floor */
html { font-size: 100%; }
body { font-size: 11pt; line-height: 1.45; color: #000; background: #fff; }
h1 { font-size: 18pt; }
h2 { font-size: 14pt; }
h3 { font-size: 12pt; }
/* Links survive monochrome, and their URL travels with them */
a { color: #000 !important; text-decoration: underline; }
a[href^="http"]::after {
content: " (" attr(href) ")";
font-size: 9pt;
word-break: break-all;
}
/* Never orphan a heading, never split a figure or a code block */
h1, h2, h3, h4 { break-after: avoid; page-break-after: avoid; }
p, li { orphans: 3; widows: 3; }
pre, blockquote, figure, table, tr, img {
break-inside: avoid;
page-break-inside: avoid;
}
pre { font-size: 9pt; white-space: pre-wrap; }
/* Tables: repeat the header on every page */
thead { display: table-header-group; }
tfoot { display: table-footer-group; }
/* Long URLs and wide media must not force a horizontal overflow */
img, svg, video { max-width: 100% !important; height: auto !important; }
table { width: 100%; border-collapse: collapse; }
}
The a[href^="http"]::after trick is the single highest-value addition, and it is why print stylesheets age better than people expect. On paper, a hyperlink is dead text. Printing the destination after the anchor text turns a printed article back into something a reader can act on later.
Where CSS print still fails, and what to do about it
Print CSS is more capable than its reputation suggests, and less capable than its specification claims. Both halves matter.
The genuine gaps are narrow now. Page margin boxes, the @top-center and @bottom-right constructs that let you print “Page 3 of 12”, were unsupported in every major browser for years. Chrome added them in version 131 in October 2024, and Safari followed in 18.2 in December 2024, which is why @page now sits at roughly 95% global support on caniuse. The marks and bleed properties from the latest specification are still unimplemented anywhere, which matters only if you are producing press-ready artwork. If you need guaranteed page counters today, the reliable route is still a paged-media renderer rather than a browser: Prince, WeasyPrint, or Paged.js in the browser as a polyfill.
The bigger gap is not the specification, it is the page. Three failure modes account for most bad printouts:
Scroll containers. If content lives inside an element with its own overflow and a fixed height, the print engine may only capture the visible slice. The fix is to unset the constraint in print: @media print { .scroll-area { height: auto !important; overflow: visible !important; max-height: none !important; } }.
Stripped backgrounds. Browsers drop background colours and background images by default to save ink, which is why a chart with white-on-blue labels prints as blank. print-color-adjust: exact forces the declared colours through, and it is supported in Chrome, Safari and Firefox 97 and later. Use it surgically on data elements, not on the whole page.
Unbreakable blocks. A code block, a large figure, or a table taller than the page will either overflow or leave a canyon of white space. break-inside: avoid protects small blocks; for large ones you want break-inside: auto so they can split, plus white-space: pre-wrap so long lines stop pushing content off the edge.
What CSS print cannot fix is content that never existed in the DOM. A page that renders its body from a client-side fetch, behind an infinite scroll, or inside a modal has nothing to print until JavaScript runs, and some print pipelines run it badly. If your article is only reachable through infinite scroll, add real pagination or a full-text view. That is a SEO decision as much as a print one, and it is the same fix.
The accessibility objection: stop overriding the reader’s font size
The sharpest criticism in the discussion came from a developer who agreed with almost all of it and still objected to one line. Resetting type to 12pt is, in his framing, the same mistake as detecting a low-resolution phone screen and inflating the font size, because it overrides a preference the reader already set at the operating-system or browser level. If someone has already raised their default size, a hard-coded 12pt takes it away.
That is accessibility 101, and it points at a real tension in Puth’s snippet. The honest resolution is to separate layout from type. Fixing page geometry, hiding navigation, preventing split tables and printing link destinations are all unambiguously good: they add information the reader cannot otherwise get. Forcing an absolute font size is different, because it substitutes your judgement for theirs.
The practical compromise, if you want one, is to set print type only where your own screen stylesheet has already committed to a fixed scale, and to keep the units relative elsewhere. If your body text is 1.125rem on screen, leave it relative in print and let the reader’s preference flow through. If your site is built on a rigid pixel grid that produces 20pt body text on A4, then yes, override it, because 20pt body text is not a preference, it is a bug.
Why printable websites matter more in Malaysia than the thread assumes
The Hacker News discussion was largely American and largely about personal blogs, note-taking and archival. The stakes are different here, and higher, for a set of very ordinary reasons.
Records that must survive an audit. Malaysian income tax rules require business records to be kept for seven years. In practice that means a folder of receipts, invoices and bank statements, and increasingly it means a folder of PDFs made with Ctrl-P. With e-Invoicing now the default channel for most businesses, the PDF is the artefact that actually enters the audit file. A receipt page that prints as a cropped strip with the total missing is a compliance problem, not a design nit.
Claims and reimbursement. In Malaysian manufacturing and construction companies, expense claims still move on paper with a signature. Grab receipts, toll statements, hotel folios and supplier invoices get printed, stapled and signed. Anyone who has tried to print a ride-hailing receipt and found the fare amount sliced off the bottom knows exactly what this article is about.
Controlled documents on the shop floor. This is where print quality stops being convenience. Work instructions, inspection sheets, welding parameter cards and shot-peening coverage diagrams get printed, laminated and hung at the workstation. A printed instruction whose torque table breaks across a page boundary, or whose diagram loses its colour-coded zones because the browser dropped the background, is a quality risk. ISO 9001 and IATF 16949 audits ask for controlled copies. If your document control system is a web app, the print output is the controlled copy.
Statements and contracts that outlive the site. Utility bills, insurance schedules, tenancy agreements, loan statements. Sites reorganise their URLs, portals close, accounts get deactivated. The printed or PDF copy is the only version that survives. One commenter in the thread described printing order confirmations and bill-pay receipts precisely because bookmarks rot.
Devices that never had a browser. A printed copy reads without power, without a login, and without a working network. That durability is also the security argument a commenter raised: a printed record cannot be silently edited by a backend update.
A printable websites checklist
| Problem | What the reader sees | Fix |
|---|---|---|
| Site header and nav | A half-page slab of logo and menu on page one | .noPrint { display: none } on the header |
| Sticky sidebar or CTA | The same advert reprinted on every page | Hide wrappers in @media print |
| Coloured links | Pale grey, indistinguishable from body text | a { color: #000 !important } |
| Dead hyperlinks | No way to follow the source on paper | Print attr(href) after the anchor |
| Oversized headings | One headline fills a third of the page | Point-based type scale in print |
| Wide tables | Right-hand columns cut off | table { width: 100% }, allow wrapping |
| Long code blocks | Pushed off the right edge | white-space: pre-wrap, break-inside: auto |
| Charts with fills | Blank boxes, no data | print-color-adjust: exact on the chart only |
| Split tables | Header row on page one, data on page two | thead { display: table-header-group } |
| Orphaned headings | A heading at the foot of a page | break-after: avoid on headings |
| Cookie banner | Printed across the article text | Hide it, or render it only on screen |
| Author and date | Missing from the printout | .onlyPrint attribution line |
How to test print output without owning a printer
You do not need paper. Every mainstream browser prints to PDF, and you can automate it, which means you can put a print check in CI instead of finding out from a reader.
The fastest manual loop is headless Chrome:
chrome --headless --disable-gpu \
--print-to-pdf=print-check.pdf \
--no-pdf-header-footer \
https://example.com/article/
That gives you the real print pipeline with the browser’s own headers and footers suppressed, which is closer to what a reader sees after unchecking those boxes. Then open the PDF and look for four things: whether navigation appears, whether any table is cut, whether link colours survive greyscale, and whether content is missing entirely.
For a scripted check, Playwright exposes the same engine:
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://example.com/article/", wait_until="networkidle")
page.emulate_media(media="print") # apply @media print rules
page.pdf(
path="print-check.pdf",
format="A4",
print_background=False, # mimic the default ink-saving mode
margin={"top": "18mm", "bottom": "18mm",
"left": "16mm", "right": "16mm"},
)
browser.close()
Two details make this useful rather than decorative. emulate_media(media="print") applies your print stylesheet, and print_background=False reproduces the default that strips backgrounds, which is the setting that turns charts blank. Test with it off, because that is what most readers get.
If you need paged-media features no browser implements, WeasyPrint and Prince take the same HTML and CSS and render true A4 pages with working page counters, running headers and footnotes. That is the right tool if you are generating invoices or reports server-side rather than letting the reader press Ctrl-P.
Frequently asked questions
Does a print stylesheet change how my site looks on screen?
No. Rules inside @media print are only applied when the page is rendered for a printer or a PDF export. The screen version is untouched, and the media query adds nothing to your Core Web Vitals because none of it applies during a normal page view.
Why do my coloured links turn pale grey when printed?
Browsers drop backgrounds and adjust colours by default to save ink, and a mid-tone link colour often flattens into grey. Setting a { color: #000 !important } inside the print block fixes it, and printing the destination URL after the text makes the link useful on paper.
Should I hide everything except the article?
Hiding chrome is right. Hiding context is not: keep the headline, the byline, the date and the source attribution, because a printout without a date is hard to cite. Tag the byline block with a print-only class so it appears on paper and stays out of the way on screen.
Do web apps need this, or only articles?
Only the screens people actually file. Statements, receipts, invoices, inspection reports, delivery orders and confirmation pages are the ones worth the effort. A marketing landing page does not need a print stylesheet; a payment confirmation absolutely does.
How much work is it, honestly?
For a typical blog or documentation site, the snippet above is most of it, and the first version takes under an hour. The work is not writing the CSS, it is looking at your own print preview and believing what you see.
Conclusion
“Websites Should Be Printable” is a small post making a small claim, and the response it drew says the claim is not small at the edges. Print CSS is not difficult, it is not new, and it is not going away, because the reasons people print have not gone away either: audits, claims, controlled documents, contracts, and the plain desire to read something with a pen in hand.
The work is roughly 40 lines and one honest Ctrl-P. Start with the four fixes that carry almost all the value: hide the navigation, reset the type scale into points, force links to black, and stop tables and code blocks from splitting across pages. Then print your own site to PDF and look at it. If you cannot read the result, neither can the person who needed to file it.
At ZFRBuild we write about the practical side of technology for Malaysian readers and developers, from buying decisions to the plumbing underneath them. If this was useful, the next step is small: press Ctrl-P on a page you own today.
More from ZFRBuild
- Swedish government offices to ban ChatGPT and Claude
- Malaysia’s busiest stretch: what to book before 5 December
- Alternatives to Animal Testing Are Finally Taking Off
Related Article
- Christmas Eve 2026: parades, fireworks and food fairs โ Christmas Eve 2026 falls on Thursday 24 December. Where to go in KL, Penang and Melaka for parades, mall shows, food fairs, carols and midnight Mass.
- Claude Code’s ‘Don’t Ask Again’ leaked 1,122 secret files โ Apiiro found 1,122 public GitHub files where Claude Code’s ‘Don’t Ask Again’ saved plaintext passwords and API keys, and two scanners missed 215 of th
- Why did some Apollo missions carry a grenade launcher? โ Apollo 14 and 16 carried a four-barrel grenade launcher to map the Moon’s subsurface with seismic waves โ and most of the grenades never fired.
