By default, when you print a web page, the page title and and URL are printed at the top of the page, and likewise the date and time are printed at the bottom.
It is possible to remove this additional as you are printing through the PAGE SETUP menu (under FILE in Internet Exp)
Does anyone know of a way of doing this via CSS or javascript?
To hide the element, add “display:none” to the element with CSS.
In Firefox, in the Page Setup, there should be options under Header & Footer to remove the Date and Time from printing.
You can use CSS to change the appearance of your web page when it's printed on a paper. You can specify one font for the screen version and another for the print version. You have seen @media rule in previous chapters.
Open the required document and go to File > Print. 2. In the pop-up that follows, click More Settings. Now, uncheck the Headers and footers option.
Historically, it's been impossible to make these things disappear as they are user settings and not considered part of the page you have control over.
However, as of 2017, the @page
at-rule has been standardized, which can be used to hide the page title and date in modern browsers:
@page { size: auto; margin: 0mm; }
Print headers/footers and print margins
When printing Web documents, margins are set in the browser's Page Setup (or Print Setup) dialog box. These margin settings, although set within the browser, are controlled at the operating system/printer driver level and are not controllable at the HTML/CSS/DOM level. (For CSS-controlled printed page headers and footers see Printing Headers .)
The settings must be big enough to encompass the printer's physical non-printing areas. Further, they must be big enough to encompass the header and footer that the browser is usually configured to print (typically the page title, page number, URL and date). Note that these headers and footers, although specified by the browser and usually configurable through user preferences, are not part of the Web page itself and therefore are not controllable by CSS. In CSS terms, they fall outside the Page Box CSS2.1 Section 13.2.
... i.e. setting a margin of 0 hides the page title because the title is printed in the margin.
Credit to Vigneswaran S for this tip.
Its simple. Just use css.
<style> @page { size: auto; margin: 0mm; } </style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With