O'Reilly logo

Sams Teach Yourself CSS in 10 Minutes by Russ Weakley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required