Sometimes, we want to disable browser print options (headers, footers, margins) from pages with CSS.
In this article, we’ll look at how to disable browser print options (headers, footers, margins) from pages with CSS.
How to disable browser print options (headers, footers, margins) from pages with CSS?
To disable browser print options (headers, footers, margins) from pages with CSS, we use the @page
rule.
For instance, we write
@page {
size: auto;
margin: 0mm;
}
html {
background-color: #ffffff;
margin: 0px;
}
body {
border: solid 1px blue;
margin: 10mm 15mm 10mm 15mm;
}
to add the @page
rule to set the print styles.
We use margin: 0mm;
to set margin to 0 for print.
Conclusion
To disable browser print options (headers, footers, margins) from pages with CSS, we use the @page
rule.