Printer Friendly Version

User 418717 Photo


Registered User
25 posts

The only thing I know about coding is what I've learned from trial and error. When I started I knew NOTHING, however; I have come quite far in the last 10 months but I'm the first to admit - I don't know everything! I have some things on my site that I would like for others to be able to print without printing the whole page. What I want to know is how to set up a "Printer Friendly Version". I haven't the first clue on where to start with this.

I need to know step by step, (if possible), how to. I may look at the answer and understand exactly what to do but then again - I may not so layman's terms would be much appreciated.

Thank!
Crazy Grandma
User 355448 Photo


Ambassador
3,144 posts

Crazy Grandma,

You need to set up a style for printing, and then set a class for deciding what prints and what does not. I use an external style sheet named print.css. Here is the code for the style:
.noprint {
visibility:hidden; /* All elements with this class will not print to a printer */

}
body {
color : #000000;
background : #ffffff;
font-family : "Times New Roman", Times, serif; font-size : 12pt;
visibility: visible;
size: landscape;
}
a {
text-decoration : underline;
color : #0000ff;
}

Now if I want something to NOT print, I give it a class of noprint. You can select large areas such as your navigation and maybe have a code that looks like this:
<div class="noprint"> put all your navigation code here </div>

Or you can select a single paragraph to not print using something like:
<p class="print"> this will display but not print </p>

By using an external style sheet, I can apply it to each and every page as needed without putting it in each page. That way, if I want to change the printed font to something else, a single change does it for the entire site.

Hope this is understandable.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.