Forcing a page break with CSS

Here is a simple style sheet method for making a web page have page breaks, or form feeds in it.

Example:

Try going to the following example page and printing it. It will come out on two separate pages. http://www.sscnet.ucla.edu/test/formfeed.htm

Source Code:

1. <html><head><title>Form Feed Test</title>2. <STYLE TYPE="text/css"> P.newpage {page-break-before: always} </STYLE>3. </head>4. <body>5. <center><h1>Page 1</h1></center>6. <P CLASS="newpage">7. <center><h1>Page 2</h1></center>

Explanation:

  • Line 2 is where you set up your style sheet definition.
  • Line 6 shows what you put wherever you want a page break.