Sometimes, we want to add margin while printing HTML page with CSS.
In this article, we’ll look at how to add margin while printing HTML page with CSS.
How to add margin while printing HTML page with CSS?
To add margin while printing HTML page with CSS, we use the @page
rule.
For instance, we write
@page {
size: auto;
margin: 25mm 25mm 25mm 25mm;
}
to set the margin in the @page
rule to set the margin fori the printed page.
Conclusion
To add margin while printing HTML page with CSS, we use the @page
rule.