Contents Index Topic Contents | ||
Previous Topic: Managing Style Sheets Next Topic: Dynamic Content |
Style Sheets and Printing
The STYLE and LINK elements support the MEDIA attribute, which defines the output device for the style sheet. Values for MEDIA are SCREEN, PRINT and ALL. The default is SCREEN, so not setting the MEDIA attribute causes the style sheet to always be applied to the page for the screen as well as printing. The PRINT value specifies that the style sheet is used when the page is printed; this value does not affect how the document will be displayed onscreen. The ALL value determines that the document is formatted for both the screen and print.
Note that all filter: styles, including visual effects filters, are ignored when printing. Internet Explorer renders this content for printing with any applicable text style properties.
Setting Page Breaks For Printing
You can control the placement of page breaks in your documents by using the page-break-before and page-break-after attributes. These attributes indicate when to break to a new page when printing the document and on what page (left or right) to resume printing. These attributes are useful when you want to print long documents into logical sections.
For example, the following document defines a class "page" in a style sheet and uses it to set page breaks in the document.
<HTML> <HEAD><TITLE>Dynamic Styles: Page Breaking</TITLE> <STYLE> BR.page { page-break-after: always } </STYLE> </HEAD> <BODY> . content on page 1 . <BR CLASS=page> . content on page 2 . </BODY> </HTML>You can set page breaks from within a script by setting the pageBreakBefore and pageBreakAfter properties on the style object. The following example sets a page break immediately before each H1 element in the document. The heading is subsequently printed on a right-hand page.
var coll = document.all.tags("H1"); for (i=0; i<coll.length; i++) { coll(i).style.pageBreakBefore = "always right"; }
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.