Style pageBreakInside Property
Example
Avoid a page break inside the <p> element with id="footer":
document.getElementById("footer").style.pageBreakInside = "avoid";
Try it Yourself »
Definition and Usage
The pageBreakInside property sets or returns the page-break behavior inside an element (for printing or print preview).
Note: The pageBreakInside property has no effect on absolutely positioned elements. The page break is only visible in a print preview or when printing.
Tip: Avoid page-break properties inside tables, floating elements, and block elements with borders.
Browser Support
Property | |||||
---|---|---|---|---|---|
pageBreakInside | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the pageBreakInside property:
object.style.pageBreakInside
Set the pageBreakInside property:
object.style.pageBreakInside = "auto|avoid|initial|inherit"
Property Values
Value | Description |
---|---|
auto | Insert a page break inside the element if necessary. This is default |
avoid | Avoid a page break inside an element |
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 inside an element when printing |
CSS Version | CSS2 |
Related Pages
CSS reference: page-break-inside property
❮ Style Object