Computer >> Computer tutorials >  >> Programming >> Javascript

How to set the minimum number of lines for an element that must be visible at the top of a page in JavaScript?


Use the orphans property in JavaScript to set the minimum number of lines for an element that must be visible at the top of a page. You can try to run the following code to learn how to implement orphans property −

document.getElementById("p").style.orphans

This is how you can return the orphans property −

var res = object.style.orphans;

This is how to set the orphans property −

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