{"id":19,"date":"2008-02-13T07:00:04","date_gmt":"2008-02-13T13:00:04","guid":{"rendered":"http:\/\/cssnewbie.com\/css-rules\/7-tips-print-style-sheets\/"},"modified":"2008-02-13T07:00:04","modified_gmt":"2008-02-13T13:00:04","slug":"7-tips-print-style-sheets","status":"publish","type":"post","link":"https:\/\/cssdeck.com\/blog\/7-tips-print-style-sheets\/","title":{"rendered":"7 Tips for Great Print Style Sheets"},"content":{"rendered":"<p><img src='https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2008\/02\/print-style-sheets.jpg' alt='Print documents - photo by desi.italy' title='Photo by desi.italy. Used under a Creative Commons license.' \/><\/p>\n<p>CSS doesn\u2019t apply exclusively to the Realm of the Screen. You can also write style sheets that apply to <a href=\"\/definition\/what-is-this-css-thing-anyway\/\">the medium that first spawned them<\/a> \u2013 print. This can be a very useful trick, since people read on the screen very differently than they read print documents. And your fancy-dancy layout may look stellar at 1024&#215;768, but that doesn\u2019t mean it rocks equally at 8 1\/2&#8243; x 11&#8243;.<\/p>\n<p>So here are a few tips for creating a print style sheet that will ensure your website is user-friendly, regardless of the medium it ends up in. <\/p>\n<h3>1: Specify a Print Style Sheet<\/h3>\n<p>How\u2019s that for a great opener? Specifying the style sheet in your code is the first step to a much more useable website. Here\u2019s how you do it:<\/p>\n<pre lang=\"html4strict\" escaped=\"true\" line=\"1\">&lt;link rel=\"stylesheet\" href=\"print.css\" \nmedia=\"print\" \/&gt;<\/pre>\n<p>The important part here is the media=\u201dprint\u201d option. This tells the web browser to only apply these styles to print media.<\/p>\n<h3>2: Build On Your Screen CSS<\/h3>\n<p>One nice trick you can use is to build your print style sheet to amend your screen style sheet. To do this, simply neglect to reference a medium in your screen CSS link, like so:<\/p>\n<pre lang=\"html4strict\" escaped=\"true\" line=\"1\">&lt;link rel=\"stylesheet\" href=\"screen.css\" \/&gt;\n&lt;link rel=\"stylesheet\" href=\"print.css\" \nmedia=\"print\" \/&gt;<\/pre>\n<p>This causes your screen style sheet to be applied to both screen <em>and<\/em> print. Meaning, your print CSS only has to describe the things you want to do differently.<\/p>\n<h3>3: Wipe Out Your Screen CSS<\/h3>\n<p>Of course, if you want your print CSS to differ widely from your screen CSS, denoting all the differences between the two would be tedious. In that case, you\u2019d want to do something like this:<\/p>\n<pre lang=\"html4strict\" escaped=\"true\" line=\"1\">&lt;link rel=\"stylesheet\" href=\"screen.css\" \nmedia=\"screen\" \/&gt;\n&lt;link rel=\"stylesheet\" href=\"print.css\" \nmedia=\"print\" \/&gt;<\/pre>\n<p>Specifying a media of \u201cscreen\u201d for your main CSS file means your print style sheet is building upon a blank slate. If  you\u2019re making a lot of changes, this can be useful.<\/p>\n<h3>4: Hide Extraneous Elements<\/h3>\n<p>Not everything that is useful on the screen is nearly so useful in print. For example, the navigation at the top of your page, or the blogroll in your sidebar, aren\u2019t nearly so useful when they take up a full printed page and obscure your text. Consider hiding them in your print style sheet by creating a <a href=\"\/css-rules\/css-rules-multiplicity\/\">list of multiple selectors,<\/a> like so:<\/p>\n<pre lang=\"css\" escaped=\"true\" line=\"1\">#navigation, #blogroll {\n\tdisplay: none;\n}<\/pre>\n<p>Then, as you come across more elements that shouldn\u2019t be in your printed version, you can just add them to the list.<\/p>\n<h3>5: Bump Up Font Sizes and Line-Heights<\/h3>\n<p>While I\u2019m sure your 10-pixel-high cramped Helvetica looks so very avant-garde on the screen, people usually prefer a little more room when they\u2019re reading on the page. Try bumping up the font-size and line-height a little compared to the screen:<\/p>\n<pre lang=\"css\" escaped=\"true\" line=\"1\">body {\n\tfont-size: 120%;\n\tline-height: 130%;\n}<\/pre>\n<h3>6: Move to Serif Fonts<\/h3>\n<p>Serif fonts were created to make it easier to read words on the printed page. The serifs (the little \u201cfeet\u201d at the bottoms of letters) help the eye define the edges of the letters and lines on the page. Sans-serif fonts, on the other hand, were invented for the screen: the serifs on low-resolution monitors and at small sizes tend to make the letters look a little fuzzy. So while Helvetica may be a great choice for the screen, perhaps Georgia would be better suited for the page:<\/p>\n<pre lang=\"css\" escaped=\"true\" line=\"1\">body {\n\tfont-family: Georgia, \"Times New Roman\", \n\tTimes, serif;\n}<\/pre>\n<h3>7: Think in Inches and Points<\/h3>\n<p>Pixels are a useful unit of measurement when dealing with the screen, but they lose some of their usefulness when you move to the printed page. At that point, it\u2019s useful to remember that in CSS, you\u2019re not limited to setting sizes in pixels, percentages or ems. You also have inches, centimeters, millimeters, points, and even picos at your disposal. Make use of them:<\/p>\n<pre lang=\"css\" escaped=\"true\" line=\"1\">body {\n\tfont-family: Georgia, \"Times New Roman\", \n\tTimes, serif;\n\tfont-size: 12pt;\n\tline-height: 18pt;\n}\nbody #container {\n\tmargin: 1in 1.2in .5in 1.2in;\n}\n<\/pre>\n<p>What other print style sheet tips have I missed? Share the love in the comments!<\/p>\n<div class=\"wp-socializer wpsr-share-icons \" data-lg-action=\"show\" data-sm-action=\"show\" data-sm-width=\"768\" ><h3>Share and Enjoy !<\/h3><div class=\"wpsr-si-inner\"><div class=\"wpsr-counter wpsrc-sz-32px\" style=\"color:#000\"><span class=\"scount\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook,twitter,linkedin,pinterest,print,pdf\">0<\/span><\/span><small class=\"stext\">Shares<\/small><\/div><div class=\"socializer sr-popup sr-32px sr-circle sr-opacity sr-pad sr-count-1 sr-count-1\"><span class=\"sr-facebook\"><a rel=\"nofollow\" href=\"https:\/\/www.facebook.com\/share.php?u=\" target=\"_blank\"  title=\"Share this on Facebook\"  style=\"color: #ffffff\" ><i class=\"fab fa-facebook-f\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-twitter\"><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/intent\/tweet?text=%20-%20%20\" target=\"_blank\"  title=\"Tweet this !\"  style=\"color: #ffffff\" ><i class=\"fab fa-twitter\"><\/i><\/a><\/span>\n<span class=\"sr-linkedin\"><a rel=\"nofollow\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=\" target=\"_blank\"  title=\"Add this to LinkedIn\"  style=\"color: #ffffff\" ><i class=\"fab fa-linkedin-in\"><\/i><\/a><\/span>\n<span class=\"sr-pinterest\"><a rel=\"nofollow\" href=\"https:\/\/www.pinterest.com\/pin\/create\/button\/?url=&amp;media=&amp;description=\" target=\"_blank\"  title=\"Submit this to Pinterest\"  style=\"color: #ffffff\" data-pin-custom=\"true\"><i class=\"fab fa-pinterest\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"pinterest\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-print\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Print this article \"  style=\"color: #ffffff\" ><i class=\"fa fa-print\"><\/i><\/a><\/span>\n<span class=\"sr-pdf\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Convert to PDF\"  style=\"color: #ffffff\" ><i class=\"fa fa-file-pdf\"><\/i><\/a><\/span><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<\/p>\n<p>CSS doesn\u2019t apply exclusively to the Realm of the Screen. You can also write style sheets that apply to the medium that first spawned them \u2013 print. This can be a very useful trick, since people read on the screen [&#8230;]<\/p>\n<p><a class=\"more-link article\" href=\"https:\/\/cssdeck.com\/blog\/7-tips-print-style-sheets\/\" title=\"Click to read '7 Tips for Great Print Style Sheets'\">Read Article<\/a><\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[173,191],"tags":[261],"_links":{"self":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/19"}],"collection":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":0,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"wp:attachment":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}