February 1, 2000 - Page Breaks in Printing | WebReference

February 1, 2000 - Page Breaks in Printing

Yehuda Shiran January 31, 2000
Page Breaks in Printing
Tips: February 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

In order to insert page breaks when the document is printed, you need to use the page-break-before and page-break-after CSS styles. These styles only work with the following block elements: BLOCKQUOTE, BODY, CENTER, DD, DIR, DIV, DL, DT, FIELDSET, FORM, Hn, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, UL, and XMP. Here is an example that works with the P tag:

<HEAD><TITLE>Dynamic Styles: Page Breaking</TITLE>
  P.page {page-break-after: always}
<P CLASS=page>
  content on page 1
  content on page 2

Learn more about printing Web pages in our tip from October 29, 1999.