Accepting selected projects for Q2 2024 Check availability →
SERVER 02SYSTEM ONLINELAST SYNC: 03:17:44RSS 2.0 — ONLINE
HALF ASSEDTECHNICAL NOTES_
EST. 1999ISSUE 04.2BEST VIEWED AT 1024 × 768
TECHNICAL NOTES / TECHNICAL NOTES / CSS / RECORD 6a4e11
[CSS]NOTE

A separate print stylesheet with CSS2

POSTED: 20.09.2001AUTHOR: ADMIN2 MIN READCOMMENTS: 0

CSS2 allows presentation rules to be selected for print. Use the same document as the screen version and adjust the layout for paper, then test actual output in the browsers the site supports.

Separate screen assumptions from content

Link a print stylesheet using media="print", or place print rules in an @media print block. Remember that rules in an unqualified stylesheet still apply unless overridden. Remove fixed widths, unnecessary floats and fixed heights that can clip text. Hide navigation and forms that have no printed use while keeping the title, article and any necessary contact details.

Preserve meaning without colour

Use dark text on a light background and make sure important distinctions survive a monochrome printer. Do not rely on background images being printed. If a linked document is necessary to understand the article, give its address or a numbered reference in the content. Browser support for generated content varies, so test any automatic printing of link addresses before relying on it.

Inspect more than the first page

CSS2 defines page-break-before, page-break-after and page-break-inside, but implementations do not apply every rule consistently. Try a long article, a table and a large illustration. Look for lost lines, blank sheets and headings separated from their paragraphs. Check both A4 and Letter paper where the audience uses them, and avoid shrinking the entire document merely to accommodate one wide table.

MAINTENANCE

Repeat the print check after changing the main stylesheet. A screen rule with greater specificity can silently undo an otherwise working print layout.

References

W3C: CSS2 media types, May 1998

W3C: CSS2 paged media