Prevent headers/footers on page printer

  Awestruck 17:26 26 Apr 2009

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 22:00 26 Apr 2009

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

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

  Awestruck 10:17 27 Apr 2009

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 15:05 27 Apr 2009

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 16:45 27 Apr 2009

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 17:54 27 Apr 2009

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 17:00 30 Apr 2009

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.

Elsewhere on IDG sites

iMac Pro review

Illustrator Charles Williams on how to create magazines and book covers

iMac Pro review

Les meilleures prises CPL (2018)