Forum Moderators: not2easy

Message Too Old, No Replies

printing form

How to hide header and footer when printing a form

         

jeriani

7:24 am on May 16, 2003 (gmt 0)

10+ Year Member



Hi everybody,

I've got a web form that I print with an input button everytthing is ok with that. Now I'd like to hide the footer and header on the printed form. Is it possible with CSS, all ideas are welcome.

Tahnks in advance

Jerome

keimano tokoyami

7:41 am on May 16, 2003 (gmt 0)

10+ Year Member



Hi,
You could create a print style sheet and specify your header and footer display type to "none".

Assuming you assigned your header and footer with id's, here's an example:

print.css:
#header, #footer {display: none;}

And link the "print.css" on your form page:

<link rel="stylesheet" type="text/css" media="print" href="print.css">

Cheers,
KT

DrDoc

7:43 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World, Jerome!

And, you too, KT :)

Sinner_G

7:45 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep, print style sheet is the way to go, with the only problem being it is not recogniseg by NS browsers.

Sinner

DrDoc

7:50 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



...you mean, not recognized by stone-age Netscape browsers? ;)

jeriani

8:13 am on May 16, 2003 (gmt 0)

10+ Year Member



Thanks every body, I'm going to try.
See ya soon.
Jerome

jeriani

8:34 am on May 16, 2003 (gmt 0)

10+ Year Member



hi
I tried, but it hasn't done what I'd like. I re do my question. It's not the header and the footer of the html page that I want to hide when I print. It's the title and page number on the top of the printed form and the url at the bottom(for example if you print a web page with File-->Print of the browser this information appear).

I don't know if I'm very clear, but any help will be good
TIA

Jerome

DrDoc

8:48 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That cannot be changed by any settings you make/change on the Web page. It's a browser and printing issue.

DrDoc

8:49 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You change it through File » Page setup

See the section "Headers and Footers"?

Paul in South Africa

8:51 am on May 16, 2003 (gmt 0)

10+ Year Member



In IE you can remove the header and footer under File>Page Setup.

In Opera 7.11 (don't know about other versions) it is under File>Print options.

I don't know about NN.

I don't know of any way it can be done without changing these settings.

<added>Slow this morning ;)</added>

jeriani

9:00 am on May 16, 2003 (gmt 0)

10+ Year Member



SO it can't be done programmatically, I should tell to the future user to change their File>> Page Set up.

Ok thanks a lot for all these information

Jerome

TheDoctor

9:37 am on May 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I should tell to the future user to change their File>> Page Set up

They may, of course, want to print the URL along with the page. I quite consciously set my print options so that I can see on the hard copy where a got a page from. I might want to go back there!

As far as stone age browsers are concerned, it is also the case that NN4 does not recognise display:none. You can, if you have set up printer-friendly page using CSS, therefore warn NN4 users that they are not going to benefit, by including in your HTML something like


<p class="stoneage">Warning: you are using a fairly old browser, which may not be able to print this page in a readable format</p>

and in your CSS

.stoneage { display:none; }

Only NN4 users will see the message.