Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style pageBreakAfter Property

Style pageBreakAfter Property

Style Object Reference The Style object


Definition and Usage

The pageBreakAfter property sets or returns the page-breaking behavior after an element (for printing or print preview).

**Note:** The pageBreakAfter property does not affect absolutely positioned elements.

Syntax

Set the pageBreakAfter property:

Object.style.pageBreakAfter="auto|always|avoid|emptystring|left|right|inherit"

Return the pageBreakAfter property:

Object.style.pageBreakAfter

Value Description
auto Default. A page break is inserted after the element if necessary.
always Always insert a page break after the element.
avoid Avoid inserting a page break after the element.
"" (empty string) Do not insert a page break after the element.
left Insert one or two page breaks after the element, up to a blank left page.
right Insert one or two page breaks after the element, up to a blank right page.
inherit The value of the pageBreakAfter property is inherited from the parent element.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the pageBreakAfter property.

**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".


Example

Example

Always after every id="footer"

element, set a page break:

Runoob Tutorial(runoob.com)

This is a heading

This is a paragraph

Click the button above to see the change in printing or print preview.

Try it »


Style Object Reference The Style object