How to make an HTML page in A4 paper size page with CSS?

Spread the love

Sometimes, we want to make an HTML page in A4 paper size page with CSS.

In this article, we’ll look at how to make an HTML page in A4 paper size page with CSS.

How to make an HTML page in A4 paper size page with CSS?

To make an HTML page in A4 paper size page with CSS, we use the @page rule.

For instance, we write

@page {
  size: 7in 9.25in;
  margin: 27mm 16mm 27mm 16mm;
}

to set the size property to the width and height of a sheet of A4 paper.

We set the margin from the top to the left clockwise with margin: 27mm 16mm 27mm 16mm;.

Conclusion

To make an HTML page in A4 paper size page with CSS, we use the @page rule.

Leave a Reply

Your email address will not be published.