How to set the minimum number of lines for an element that must be left at the bottom of a page when a page break occurs inside an element with JavaScript?


Use the orphans property in JavaScript to set the minimum number of lines for an element that should be left at the bottom of a page when a page break occurs inside an element with JavaScript.

You can return the orphans property like this −

var res = object.style.orphans

Set the orphans property like this −

object.style.orphans = 'number|initial|inherit'

The following are the property values shown above −

  • number − Specify the minimum number of visible lines.
  • Initial − Set property to its default
  • Inherit − Inherits property from the parent element

Updated on: 23-Jun-2020

68 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements