Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • JS Tutorial
  • JS Exercise
  • JS Interview Questions
  • JS Array
  • JS String
  • JS Object
  • JS Operator
  • JS Date
  • JS Error
  • JS Projects
  • JS Set
  • JS Map
  • JS RegExp
  • JS Math
  • JS Number
  • JS Boolean
  • JS Examples
  • JS Free JS Course
  • JS A to Z Guide
  • JS Formatter
Open In App

HTML DOM | Style pageBreakInside Property

Last Updated : 05 Jun, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

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"

Note: Instead of this property use break-inside property because it is replaced with break-inside property

Return Values: It returns a string value, which represents the page-break behavior inside an element when printing

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" 

html
<!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 1 and above
  • Edge 12 and above
  • Internet Explorer 8 and above
  • Firefox 19 and above
  • Opera 7 and above
  • Apple Safari 1.3 and above

S

Shubrodeep Banerjee
Improve
Article Tags :
  • JavaScript
  • HTML-DOM
  • HTML-Property

Similar Reads

    HTML | DOM Style wordBreak Property
    The DOM Style wordBreak Property is used to set or return the word-break property. The word-break property is used to specify how to break the word when the word is reached at the end of the line. The line breaks in the text can occur in a certain wordBreak property. Syntax: It is used to return the
    2 min read
    HTML | DOM Style animationTimingFunction Property
    The Style animationTimingFunction property in HTML DOM defines the time of transition between the styles to make transitions smooth. It specifies the speed curve of an animation. Syntax: animation-timing-function: cubic-bezier(n1, n2, n3, n4)|linear |ease|ease-in|ease-out|initial|inherit; Return Val
    4 min read
    HTML DOM Node isSupported() Method
    The isSupported() method in HTML DOM is used to check the specified feature is supported by the specified node or not. This method is not supported by many browsers. It returns true if the feature is supported else it returns false. Syntax: node.isSupported(feature, version) Note: This method has be
    2 min read
    HTML DOM MouseEvent clientX Property
    The mouse event clientX property returns the horizontal coordinate (X-axis) of the mouse pointer in relation to the viewport when a mouse event occurs. It captures the mouse's position without considering any scroll offset.Syntax:event.clientXReturn Value: clientX returns the mouse pointer's X-coord
    1 min read
    HTML | DOM Style borderImageWidth Property
    The Style borderImageWidth property in HTML DOM is used to set or return the width of the border image. Syntax: It returns the borderImageWidth propertyobject.style.borderImageWidthIt is used to set the borderImageWidth propertyobject.style.borderImageWidth = "number|percentage|auto| initial|inherit
    5 min read
    HTML DOM Geolocation position Property
    The Geolocation position property in HTML DOM is used to return the position of a device on Earth. The returned Coordinates object could be used for various purposes including navigation and tracking the position of the device. Return Value: position.coords: The coordinates object that has all the i
    2 min read
    HTML | DOM Style whiteSpace Property
    The Style whiteSpace property in HTML DOM is used to set the whitespace for text content. It returns the whitespace property that is given to the text. Syntax: It returns the whiteSpace property. object.style.whiteSpaceIt is used to set the whiteSpace property. object.style.whiteSpace = "normal|nowr
    2 min read
    HTML | DOM Style fontStyle Property
    HTML DOM Style fontStyle Property is used to set or get font style of an element dynamically. Syntax: To set the fontStyle property :object.style.fontStyle = normal|italic|oblique|initial|inherit;To get fontStyle property value:object.style.height Property values: Valuenormalitalicobliqueinitialinhe
    2 min read
    HTML DOM Style wordSpacing Property
    The Style wordSpacing property in HTML DOM is used to set or return the spacing between the words. It can also be used to specify space between words. Syntax:  It returns the wordSpacing property. object.style.wordSpacing It is used to set the wordSpacing property. object.style.wordSpacing = "normal
    2 min read
    HTML | DOM MouseEvent clientY Property
    The MouseEvent clientY property is a read-only property which is used to return the vertical coordinate of the mouse pointer based on the current window when a mouse event was triggered. Syntax : event.clientY Return Value: It returns a number that represents the vertical coordinate of the mouse poi
    1 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences