XML technologies / CSS / CSS Cookbook / Printing

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

Introduction

Traditionally, to obtain a printer-friendly version of a website, you have to remove unnecessary elements from its text manually or use a script to produce an additional page design.

CSS, however, can transform your documents automatically when they are to be printed. This eliminates the additional time and web server resources normally needed to generate a print version through a script.

Browser support for print media with CSS is already fairly widespread today. Supporting browsers include Firefox, Internet Explorer 4+ for Windows, Internet Explorer 4.5+ for Macintosh, Netscape 6+, Safari and Opera. Some CSS properties are intended solely to control printed output, but support for these is currently very limited. Only Opera 5 and 7 understand more than two of these properties (15 of the 16 listed in the specification).

Given this situation and this book’s focus on practical techniques that work across browsers, the recipes in this chapter deal mainly with suitable style definitions for printing rather than special CSS properties for print media. Further information about these properties can be found in CSS – Das umfassende Handbuch by Eric A. Meyer (O’Reilly).

This chapter explains how to tell the browser which stylesheet to use when printing a document. We also explore ways to use a different image for printing than for display on the web. The design example in this chapter shows how to create a printer-friendly page with CSS.

  

  

 

 

 

back to top