Search w3schools.com:

SHARE THIS PAGE

Style pageBreakInside Property

Style Object Reference Style Object

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.

Syntax

Set the pageBreakInside property:

Object.style.pageBreakInside="auto|avoid|inherit"

Return the pageBreakInside property:

Object.style.pageBreakInside

Value Description
auto Insert a page break inside the element if necessary. This is default
avoid Avoid a page break inside an element
inherit The value of the pageBreakInside property is inherited from parent element


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The pageBreakInside property is only supported in Internet Explorer and Opera.

Note: The value "inherit" is not supported in IE7 and earlier. IE8 requires a !DOCTYPE. IE9 supports "inherit".


Tips and Notes

Tip: Avoid page-break properties inside tables, floating elements, and block elements with borders.


Example

Example

Avoid a page break inside the <p> element with id="footer":

<html>
<head>
<script>
function setPageBreak()
{
document.getElementById("footer").style.pageBreakInside="avoid";
}
</script>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p id="footer">This is a footer paragraph.</p>
<button type="button" onclick="setPageBreak()">Avoid page-break inside footer paragraph</button>

</body>
</html>

Try it yourself »


Style Object Reference Style Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]