Is it possible to remove the url from my css print file so that the web address does not print?

I have written several style sheets, including print.css, and it works great.

I want to remove the URL from printing on each of the pages. I begin to wonder if this is not possible. Is there an element / parameter that I can set to display: none for this?

The reason is that specific pages with the stylesheet "normal" and "print" were specially formatted, so when printing it forms a meaningful booklet. Therefore, the URL does not matter.

+55
css
03 Feb 2018-10-03T00
source share
14 answers

In Firefox https://bug743252.bugzilla.mozilla.org/attachment.cgi?id=714383 (view the page source :: HTML tag).

In your code, replace <html> with <html moznomarginboxes mozdisallowselectionprint> .

In other browsers I do not know, but you can view http://www.mintprintables.com/print-tips/header-footer-windows/

+42
Jul 29 '14 at 2:26
source share

Unfortunately not. Headers and footers are generated by the browser. Only the end user can change the footer - maybe the idea is to give the user step by step for each browser what to do. See , for example, here for a set of illustrated passages for Windows-based browsers.

The only alternative I know is creating PDF files, with which you have complete control over the print result.

+29
Feb 03 '10 at 15:00
source share

Use this code. This will help solve your problem.

 @media print { @page { margin: 0; } body { margin: 1.6cm; } } 
+15
Feb 24 '16 at 7:02
source share
@media print { a[href]:after { content: none !important; } img[src]:after { content: none !important; } }
+13
May 05 '16 at 5:50
source share

you can try this in the stylesheet:

 @page{size:auto; margin-bottom:5mm;} 

But it also removes the page number

+8
Jun 02 '15 at 9:26
source share

This solution will do the trick in Chrome and Opera by setting margin to 0 in the css @page directive. It will not (currently) work for other browsers, though ...

+5
Jul 31 '13 at 12:38
source share

If I understand you correctly, you are talking about headers and footers. They are printed by the browser. They are not part of your HTML content, so you cannot directly influence them.

Show users how to disable headers and footers in the Page Setup ... dialog box.

+3
Feb 03 '10 at 15:00
source share

It depends on your web browser. If you use Firefox, you can configure or disable these header and footer lines (URL, page number, etc.) by going to the File menu> Page Settings, then clicking the Fields and Header / Footer tab "

+3
Feb 03 2018-10-03T00
source share

Headers and footers for printing from browsers are, unfortunately, browser preferences, rather than a document-level element that you can create. See my very similar question for further workarounds and frustrations.

+3
Feb 03 '10 at 15:05
source share

Historically, it was impossible to make these things disappear, because they are user preferences and are not considered part of the page that you control.

http://css-discuss.incutio.com/wiki/Print_Stylesheets#Print_headers.2Ffooters_and_print_margins

However, since 2017, the standard @page rule has been standardized, which can be used to hide the title and page date in modern browsers:

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

Credit Vigneswaran S for this tip.

+1
Oct 06 '17 at 11:04 on
source share

I also tried everything, but finally I write below code to make the URL shorter:

 var curURL = window.location.href; history.replaceState(history.state, '', '/'); window.print(); history.replaceState(history.state, '', curURL); 

But you need to create a custom PRINT button for a user click.

+1
Dec 15 '17 at 6:07
source share

I assume that you are talking about the URL that appears in the page footer.

If so, it is set by the browser, and this is not what you can do from your code.

0
Feb 03 '10 at 15:01
source share

I'm not sure, but the URL is added by the browser when you want to print. This is not part of the page, so CSS cannot be affected. There may be a way, but it will be browser dependent.

0
03 Feb '10 at 15:01
source share

In Internet Explorer, open "Tools." Click the print option, and then adjust the page. Under the headers and footer, make all the options empty. Then it will not print on printed pages.

Hope this helps.

-3
Nov 14 '13 at 18:56
source share



All Articles