Forum Moderators: not2easy

Message Too Old, No Replies

Print Style sheets

how to link to them, how to test them

         

Clark

1:56 am on Feb 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've read a few articles on print style sheets, but they all seem to not really explain what happens with the style sheet.

I'm making one now, and I'd like to know:

1. What is the safe cross browser method to invoke print via a link?

(Is this method safe? <a title="Print This Page" href="#" onclick="window.print()">Print This Page</a> )

2. Do all the operating system automatically apply the print style sheet when selecting "File...Print"?

3. Is there a standard way to test the print style sheet? I guess you can just change the media to screen temporarily to see how it looks? Or is there a method that is more likely to mirror the way it will print?

[edited by: Clark at 2:51 am (utc) on Feb. 15, 2008]

swa66

3:52 am on Feb 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What I use:

in the normal style sheet I simply add:

@media print {
.buttons, .interactive, #menu, #crum, .ads {display:none;}
}

This prevents the extra hit on the printsheet every time (browsers load it even when not printing, even when not using it to display)

As a button (if you need one):
<a href="/print.html" onclick="window.print();return false">

The print.html actually exists for those not having javascript turned on (it asks them to go back and to use the print function of their browser)

To test it: just preview your print from you browser.

Opera typically has easier ways to preview printing, handheld etc.

Clark

5:21 am on Feb 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What I use:

in the normal style sheet I simply add:

@media print {
.buttons, .interactive, #menu, #crum, .ads {display:none;}
}

This prevents the extra hit on the printsheet every time (browsers load it even when not printing, even when not using it to display)


Sweet!

As a button (if you need one):
<a href="/print.html" onclick="window.print();return false">

The print.html actually exists for those not having javascript turned on (it asks them to go back and to use the print function of their browser)


Do you create a page for each time that you have a javascript link that would otherwise just say href="#"?


To test it: just preview your print from you browser.

Opera typically has easier ways to preview printing, handheld etc.

Of course! Doh! Print preview.

Many thanks.

swa66

7:04 pm on Feb 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually /print.html congratulates the visitor on having javascript disabled (really), and tells them to press back and use the print button of their browser instead of my icon.

Javascript enabled browsers never go to the page (due to the return of false), they'll just print it.