Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style widows property

Style widows property

Style Object Reference The Style object


Definition and Usage

The widows property sets or returns the minimum number of visible lines that an element must have at the top of a page (used for printing or print preview).

The widows property only affects block-level elements.

**Tip:** widows:5 means at least 5 lines must be visible below the page break.

**Tip:** The orphans property sets or returns the minimum number of visible lines that an element must have at the bottom of a page.

Syntax

Set the widows property:

Object.style.widows="

number

|inherit"

Return the widows property:

Object.style.widows

Value Description
number An integer specifying the minimum number of visible lines. The default value is 2.
inherit The value of the widows property is inherited from the parent element.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Only Opera supports the widows property.


Example

Example

Change the widows property for printing or print preview:

Runoob Tutorial(runoob.com)

    

Modify the window and view the print preview

Line 2

Line 3

Line 4

Line 5

Line 6

Line 7

Line 8

Try it »


Style Object Reference The Style object