Print-only CSS by eckert
How many times have you printed off a webpage, only to have it spit page after page of waste from your printer?
If you have a site that people might be printing pages from, you should include a print CSS file that will allow you to print only specific items from the page.
In the head code under your normal CSS, simply insert this code
<link rel="stylesheet" media="print" type="text/css" href="http://yoursite.com/print.css" />
Next make the print.css file on your server and start setting objects to display:block if you would like it to print or display:none if you do not.
This is not the limitation of the print.css file though. You can also change font-sizes, margins, floats, etc so that the printed version of your page looks much better.
One nice feature that you can add is a line that says something like “Thanks for visiting our site and printing this page!”. Just place it in an element and add a class like class=”printmessage”. In your regular CSS just list .printmessage {display:none;} and in your print.css label it .printmessage {display:block;}.
January 23rd, 2010 at 4:59 am
Hey great website, I noticed your website when doing some research on how to develop my blog. I was just now inquiring which spam pluggin you utilize for comments as I get tons on my blog.
February 5th, 2010 at 10:23 am
we use the default wordpress spam plugin akismet.
October 7th, 2011 at 6:59 am
This is a really handy bit of code. Printing pages of waste is a pet peeve of mine. Thanks!!