How to disable browser print options (headers, footers, margins) from page with CSS?

Sometimes, to disable browser print options (headers, footers, margins) with CSS from the page.

How to disable browser print options (headers, footers, margins) we wi’ll look at in this article from page with CSS.

How to disable browser print options (headers, footers, margins) from page with CSS?

To disable browser print options (headers, footers, margins) @page from page with CSS, we can set print styles with the directive.

For instance, we write

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

html {
  background-color: #ffffff;
  margin: 0px;
}

body {
  border: solid 1px blue;
  margin: 10mm;
}

to set the page size to auto and set margin to 0mm when the page is printed with

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

Afterthat we set styles for the html and body element that applies everywhere below that.

Conclusion

We can set print styles with the @page directive from page with CSS to disable browser print options(headers,footers,margins).

Leave a Reply