Prevent headers/footers on page printer

  Awestruck 26 Apr 09

How can I prevent headers and footers printing when someone clicks the 'Print this page' button on website pages. By headers and footers I mean the website details, page numbers and date.
My button code is:-

!--Start of page printer-->
input type="button" value="Print this page" onclick="window.print()" title="Print this page">
!--End of page printer-->



  Kemistri 26 Apr 09

Hide them and any other extraneous elements with your print stylesheet.

#id-of-element {display:none;}

  Awestruck 27 Apr 09

Thank you Kemistri for your prompt reply. However, the headers and footers are not part of my web page. They are the headers and footers inserted by IE by default. In IE if you click File-->Page setup you will see

Header &w &b Page &p of P
Footer &u&b&d

These web client commands print the web address, page number, date etc which takes up space on the printed page.

I hoped to temporarily have these turned off when someone prints my page. I think I am asking the impossible.

  Kemistri 27 Apr 09

It would have been helpful if you had described the problem more accurately - your post reads like you are asking about print stylesheets and, of course, most pages have headers and footers.

The print data, however, has nothing to do with a HTML and everything to with browser functionality. It is placed there by the browser. Some browsers allow print data to be customised or removed but we (rightly) have no control over that.

Why even worry about its presence anyway?

  Awestruck 27 Apr 09

Hello Kemistri

I did spell it out but perhaps not clearly enough.

My original post said:-
"By headers and footers I mean the website details, page numbers and date".

None of my website pages have headers or footers.

Why worry? Because I try to get an order form to print out on one page rather than say a page and a quarter. To get the order form on one page, I need to eliminate some content on the order form because the IE header and footer take up valuable rows .

I must accept defeat on this one.

  Kemistri 27 Apr 09

If you have a space issue, could you not make a bit of a space saving in your print stylesheet? Less padding in or around form inputs, for instance? Lots of potential for incremental reduction.

Incidentally, if your website has no headers or footers, where are your title, copyright notice, etc etc.? Just wondering.....

  Awestruck 30 Apr 09

Hello Kemistri

Good point! I will try eliminating padding and unnecessary spaces in the print style sheet.

many thanks



This thread is now locked and can not be replied to.

Windows 10 Home vs Windows 10 Pro comparison: Here are the extra features you get in the Pro version

Behind the scenes at Silverstone, the 70th British Grand Prix: Hisense starts UK push with Red…

How Found created this skateboard, bike and parkour stunts-laden, single-take car ad

Apple Pay UK launch date, UK user guide and participating UK banks | Apple Pay to launch in UK on 1?…

We use cookies to provide you with a better experience. If you continue to use this site, we'll assume you're happy with this. Alternatively, click here to find out how to manage these cookies

hide cookie message