Jump to content


Photo

Newbie needs help please


  • Please log in to reply
2 replies to this topic

#1 paulspoon

paulspoon
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 12 April 2006 - 12:48 PM

I hope that some one can show me some code on how to remove the following from a page that a user prints : "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

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 12 April 2006 - 01:14 PM

[!--quoteo(post=364005:date=Apr 12 2006, 08:48 AM:name=paulspoon)--][div class=\'quotetop\']QUOTE(paulspoon @ Apr 12 2006, 08:48 AM) View Post[/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 prints : "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:
.hideForPrint {
  display: none;
}

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:
<link type='text/css' rel='stylesheet' href='screen.css' media='screen' />
<link type='text/css' rel='stylesheet' href='print.css' media='print' />

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
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 paulspoon

paulspoon
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 12 April 2006 - 02:29 PM

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 ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users