Latest web development tutorials
 

Style pageBreakAfter Property

< Style Object

Example

Always set a page break after each <p> element with id="footer":

document.getElementById("footer").style.pageBreakAfter = "always";
Try it Yourself »

Definition and Usage

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

Note: The pageBreakAfter property has no effect on absolutely positioned elements. The page break is only visible in a print preview or when printing.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The pageBreakAfter property is supported in all major browsers.


Syntax

Return the pageBreakAfter property:

object.style.pageBreakAfter

Set the pageBreakAfter property:

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

Property Values

Value Description
auto Insert a page break after the element if necessary. This is default
always Always insert a page break after the element
avoid Avoid a page break after the element
"" (empty string) Page break is not inserted after the element
left Insert one or two page breaks after the element, so the next page is considered a left page
right Insert one or two page breaks after the element, so the next page is considered a right page
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: auto 
Return Value: A String, representing the page-break behavior after an element when printing
CSS Version CSS2

Related Pages

CSS reference: page-break-after property


< Style Object