Categories
CSS

How to remove page title and date when printing web page with CSS?

Spread the love

Sometimes, we want to remove page title and date when printing web page with CSS.

In this article, we’ll look at how to remove page title and date when printing web page with CSS.

How to remove page title and date when printing web page with CSS?

To remove page title and date when printing web page with CSS, we can use the @page rule.

For instance, we write

@page {
  size: auto;
  margin: 0mm;
}

to set the margin to 0mm to hide the page title.

The title is printed at the margin so setting the margin to 0mm would hide the title.

Conclusion

To remove page title and date when printing web page with CSS, we can use the @page rule.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *