HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Style pageBreakBefore Property

Style Object Reference Style Object

Example

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

document.getElementById("footer").style.pageBreakBefore="always";

Try it yourself »

Definition and Usage

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

Note: The pageBreakBefore 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 pageBreakBefore property is supported in all major browsers.


Syntax

Return the pageBreakBefore property:

object.style.pageBreakBefore

Set the pageBreakBefore property:

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

Property Values

Value Description
auto Insert a page break before the element if necessary. This is default
always Always insert a page break before the element
avoid Avoid a page break before the element
"" (empty string) Page break is not inserted before the element
left Insert one or two page breaks before the element, so the next page is considered a left page
right Insert one or two page breaks before 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 before an element when printing
CSS Version CSS2


Related Pages

CSS reference: page-break-before property


Style Object Reference Style Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE