3 replies [Last post]
chanc6
Offline
newbie
Last seen: 12 years 45 weeks ago
Joined: 2008-01-23
Posts: 2
Points: 0

I am very new to CSS and I am trying to add a footer at the end of my html page. I want it to be hidden when the page is displayed, but want it show up when the page is printed.

I tried something like the following, which I don't think is right.

out.write("

"); out.write("The footer text"); out.write("
");

Any suggestions? Thanks.

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 3 years 20 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

<div id="footer">&copy;

#footer { display: none; } /* in style.css */

#footer { display: block; } /* in print.css */

That's how I would handle it.

all ยป http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

SuperRoach
SuperRoach's picture
Offline
Enthusiast
Ballarat
Last seen: 9 years 13 weeks ago
Ballarat
Timezone: GMT+10
Joined: 2007-02-26
Posts: 291
Points: 6

Another option, you put your

Another option, you put your html out, with #footer

inside the one css file:
@media print {
#footer { display: block; }
}
@media screen {
#footer { display: none; }
}

using @media is a cheaper way to do things if your only hiding/showing a few elements between the two styles.

chanc6
Offline
newbie
Last seen: 12 years 45 weeks ago
Joined: 2008-01-23
Posts: 2
Points: 0

Thank you for your help.

Thank you for your help. They both work work perfectly.