dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: DHTML
Expertise: Beginner
Dec 23, 1998

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Create Page Breaks in an HTML Document

Question:
Is there any way (using an HTML tag or a script) to force a page break at a certain point in an HTML document when it is being printed? For example, my Web page is about five printed pages long. When it is being printed, I would like to control where the page breaks occur.

Answer:
In Internet Explorer 4, you can make use of two Cascading Style Sheets (CSS) style attributes: page-break-before and page-break-after. They can be applied as individual attributes within a style tag, or you can create a generalized DIV with a specific class that incorporates the command. These attributes will give no visual indication of the page-break in the on-screen representation of the page, but will cause a break when the document is printed.

For example, if I wanted to break the page after a table, I'd use the option:

...
Both page-break-before and page-break-after can take one of four values:

auto: (default) the page will break at the end of the element if it's at the logical end of the page (in other words, the regular printing occurs)

always: the page will always break at the indicated location.

left: insert one or two page breaks after the object until a blank left page has been reached.

right: insert one or two page breaks after the object until a blank right page has been reached.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date