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?

JavascriptObject Oriented ProgrammingFront End Technology

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
raja
Published on 27-Feb-2018 12:28:04
Advertisements