HTML DOM | Style pageBreakInside Property
The Style pageBreakInside property is used for setting or returning the page-break behavior inside an element in printing or print preview.
The Style pageBreakInside property does not affect the absolutely positioned elements.
Syntax :
- To get the property:
object.style.pageBreakInside
- To set the property:
object.style.pageBreakInside = "auto|avoid|initial|inherit"
Property Values :
- auto: It is used to insert a page break inside the element if necessary.
- avoid : It is used to avoid a page break inside an element.
- initial : It is used to set this property to its default value.
- inherit : It is used to inherit this property from its parent element.
Below program illustrates the Style pageBreakInside property :
Example: Avoiding a page break inside the <p> element with id=”footer”
<!DOCTYPE html> <html> <head> <title>Style pageBreakInside Property in HTML</title> <style> h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>Style pageBreakInside Property</h2> <br> <p id="myfooter">Geeksforgeeks is a portal for geeks.</p> <p>For avoiding page break inside footer paragraph, double click the "Avoid Page Break" button: </p> <br> <button ondblclick="pagebreak()">Avoid Page Break</button> <script> function pagebreak() { document.getElementById("myfooter") .style.pageBreakInside = "avoid"; } </script> </body> </html> |
Output:
- Before Clicking the button:

- After clicking the button:
Note: In order to see the output, please save the code in HTML file and run it on your browser. The output will be seen when you will see the PRINT PREVIEW of that file.
Supported Browsers: The browser supported by HTML DOM | Style pageBreakInside Property are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Apple Safari
Recommended Posts:
- HTML | DOM Style right Property
- HTML | DOM Style top Property
- HTML | DOM Style cursor Property
- HTML | DOM Style borderRadius Property
- HTML | DOM Style borderTopStyle Property
- HTML | DOM Style textAlign Property
- HTML | DOM Style textDecorationLine Property
- HTML | DOM Style wordWrap Property
- HTML | DOM Style tabSize Property
- HTML | DOM Style objectPosition Property
- HTML | DOM Style wordSpacing Property
- HTML | DOM Style columnCount Property
- HTML DOM | Style pageBreakAfter Property
- HTML | DOM Style outlineStyle Property
- HTML | DOM Style padding Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



