CSS document for printing
Lots of web pages have a link to a print-friendly version. What many of them don't realise is that there's no need because you can set up a second CSS document to be called up when a user prints the page.
So, your page header should contains links to two CSS documents, one for the screen, and one for printing:
<link type="text/css" rel="stylesheet" href="stylesheet.css" media="screen" />
<link type="text/css" rel="stylesheet" href="printstyle.css" media="print" />
The first line of code calls up the CSS for the screen (notice the inclusion of media="screen"
) and the second line calls up the CSS for the printable version (using media="print"
).So, what commands should you put in this second CSS document? To work it out, open a blank document and save it as
printstyle.css
. Next, point the screen CSS command to this document so that the command reads:
<link type="text/css" rel="stylesheet" href="printstyle.css" media="screen" />
.Now just keep entering CSS commands until the display on the screen matches how you want the printed version to look.
You'll certainly want to make use of the
display: none
command for navigation, decorative images and non-essential items. For more advice on this, read Print Different, which also mentions the other media for which you can specify CSS files.
Other Topics
CSS : Comments,CSS : Why, whatand need of
CSS,CSS : Background image Trick,CSS : Forcing Grayscale Printing,CSS : Two classes together,CSS : Border default value,CSS : Document for printing,CSS : Image replacement technique,CSS : Box model hack alternative,CSS : Centre aligning a block element,CSS : Class selector,CSS : Sticky Footer Layout,CSS::STYLING FORMS, mechanical Engineering, English books,Photoshop tutorials,Harry potter,Best 100 english books,Mechanical-old-question-paper,CSS : Id Selector
No comments:
Post a Comment