Jump to content

Archived

This topic is now archived and is closed to further replies.

paulspoon

Newbie needs help please

Recommended Posts

I hope that some one can show me some code on how to remove the following from a page that a user [b]prints[/b] : "The heading", "Page 1 of ?", "the webaddress in the footer" and "the date on th bottom right"

I'm currently using css but am quite new in it.

All help appreciated
Regards

Share this post


Link to post
Share on other sites
[!--quoteo(post=364005:date=Apr 12 2006, 08:48 AM:name=paulspoon)--][div class=\'quotetop\']QUOTE(paulspoon @ Apr 12 2006, 08:48 AM) [snapback]364005[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I hope that some one can show me some code on how to remove the following from a page that a user [b]prints[/b] : "The heading", "Page 1 of ?", "the webaddress in the footer" and "the date on th bottom right"

I'm currently using css but am quite new in it.

All help appreciated
Regards
[/quote]

ok, there are two steps to hiding things during printing... first, you need to declare a print and a screen style sheet (so, you'll actually have two for your site). they can be identical, or as different as you'd like, but the key is this: on the print stylesheet, you need to put those elements tha you want hidden as "display: none;"

so, for instance, if i wanted to create a class to hide elements form a print layout, i'd do something like this:

PRINT CSS:
[code]
.hideForPrint {
  display: none;
}
[/code]

now, for all intents and purposes, your regular screen CSS could be identical, but you DON'T want the above class in it. that really could be the only difference in them. then, you need to call them both in your page and tell the browser how to use them like this:
[code]
<link type='text/css' rel='stylesheet' href='screen.css' media='screen' />
<link type='text/css' rel='stylesheet' href='print.css' media='print' />
[/code]

notice the "media" attribute. this is what tells the browser which one to use for screen vs. print.

now, all you have to do is apply the class of "hideForPrint" to any elements you want to disappear when you print, and you'll be set to go.

hope this helps

Share this post


Link to post
Share on other sites
Thanx I think that this will work well, I'll try it tonight, but what are the elements names that I can use for these things that I want to hide ?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.