• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Printing from the Web > Cascading Style Sheets for Printouts

5.3. Cascading Style Sheets for Printouts

A more sophisticated way to control the way your page looks when it is printed is to take advantage of media-specific style sheets. This feature in the CSS2 specification allows a single document to be formatted on the fly depending on the device displaying or outputting it. When it's on the screen, it looks one way; when it prints out, its format changes to be read clearly on hard copy. That eliminates the need to create a separate printer-friendly version of every page on your site. See Chapter 17 for background information on how style sheets work.

The process involves creating two style sheets: one appropriate to screen display and one appropriate for print. Both style sheets are associated with the HTML document using the media attribute or the @media rule. When the browser sends the page to print, the appropriate style sheet is chosen for the job. A more detailed explanation follows.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint