scriptygoddess

15 May, 2003

Easy printer friendly pages

Posted by: Jennifer In: CSS

Ever want your readers to be able to print your pages cleanly without having to suffer through all your sidebars and graphics? Here's a way to do just that. You need to create a new stylesheet and point your pages to it. Here's how I did it:

First, you need to define the two stylesheets in your document's HEAD:

<link rel="stylesheet" type="text/css" href="<$MTBlogURL$>print.css" media="print" />
<link rel="stylesheet" href="<$MTBlogURL$>styles-site.css" type="text/css" media="screen" />

Your print.css stylesheet should not contain any extraneous items, such as banners or sidebars. Your readers will probably only want to print your posts. Therefore, any element that should not be printed should be dealt with as follows:

.element-name {
display: none;
}

You must define the original stylesheet as media="screen" and the print.css stylesheet as media="print" so that when your page is viewed on the Web, the browser will serve up the screen-based stylesheet. But when the browser's Print or Print Preview button is pressed, the browser will use the print.css stylesheet.

If you have a separate division for your copyright information, as I do, it might be a good idea to leave that in the print stylesheet as well.

There is one "gotcha" involved in printing, and it doesn't matter whether there's a special stylesheet for printing or not. When you are printing pages, such as MT blog pages, that have the "More" (extended text) link (like the "But wait! There's more!" link on these pages), the text in that link is not going to print. If you want the extended text to print, you'll need to go to the individual archive page and expand the link and then print the page(s).

Guest authored by:
Joni Mueller – jonielectric.com

2 Responses to "Easy printer friendly pages"

1 | Andy

May 17th, 2003 at 10:47 am

Avatar

I've posted this on mine now – its something i've been meaning to do and just not got round to it. What would you do if you *did* want to print the entire page though?

2 | Joni

May 17th, 2003 at 2:25 pm

Avatar

Then you would want to be sure that ALL the elements are included; but then, you really wouldn't need a separate stylesheet. I am unaware of a way to selectively do this. When I print a blog entry from the web, I'm usually only interested in that particular post. Note also, that if you print from the individual archive and comments are displayed (rather than in a separate pop-up link as mine are), then of course you get the comments also.

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements