Skip to content

TIL: Remove page margins when printing

Remove CSS page margins from a document's print layout.

1 min read

Set the page margin inside a print media query:

CSS
@media print {
@page {
margin: 0;
}
}

This removes the margin defined by the page stylesheet. The browser's print settings may still add headers, footers, or margins, and a physical printer can retain a non-printable area.

Print preview with default page margins Print preview with page margins removed
Default margins No CSS page margins

More posts connected by shared tags.