Chapter 20. Styling a Page for Print
In this lesson, you will learn how to style a page for print using CSS. You will also learn about the media type and how it is used.
Setting Up the Print CSS
In the past, many sites provided two versions of each page—one designed for the screen and the other designed to be printed. The two versions generally used the same content, but were presented in different ways.
One advantage of CSS is that you can style a page for print without the need for additional pages. This is achieved using the media
attribute, which can be applied to external style sheet links (as shown in Listing 20.1) or to the style
element for embedded styles (as shown in Listing 20.2).
Example 20.1. HTML Code Containing a Link to an External ...
Get Sams Teach Yourself CSS in 10 Minutes now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.