I have seen this question asked in a couple of different ways on SO and several other websites, but most of them are either too specific or out-of-date. I\'m hoping someone
You can set the page margin to a size that's too small to contain the text in order to disable this (borrowing from awe's answer):
@page {
size: auto; /* auto is the initial value */
margin: 0mm; /* this affects the margin in the printer settings */
}
html {
background-color: #FFFFFF;
margin: 0px; /* this affects the margin on the HTML before sending to printer */
}
body {
border: solid 1px blue;
margin: 10mm 15mm 10mm 15mm; /* margin you want for the content */
}
You can add a mozNoMarginBoxes attribute to the tag to prevent the URL, page numbers and other things Firefox adds to the page margin from being printed.
It is working in Firefox 29 and onwards. You can see a screen shot of the difference here, or see here for a live example.
Note that the mozDisallowSelectionPrint
attribute in the example is not required to remove the text from the margins; see What does the mozdisallowselectionprint attribute in PDF.js do?.
Unfortunately, there seems to be no way to resolve this problem in Internet Explorer, so you'll have to resort to PDF or ask users to disable margin texts.
The same goes for Safari; according to a comment by @Luiz Perez, the most recent versions of Safari (8, 9.1 and 10) still do not support @page
for suppressing margin texts.
I can't find anything on Edge and I don't have a Windows 10 installation available to test.