Style widows Property

Style Object Reference Style Object


Change the widows and check print or print preview:

function ChangeWidows()
border-top:19cm solid #c3c3c3;

/* set size of printed page */
size:21cm 27cm;

@media print

<div class="othercontent">
<input id="widows" value="2">
<button onclick="ChangeWidows();">Change widows</button>

<p style="font-size:120%" id="p1">
Change widows and see the print preview.<br>
Line 2<br>
Line 3<br>
Line 4<br>
Line 5<br>
Line 6<br>
Line 7<br>
Line 8<br>

<div class="othercontent">


Try it yourself »

Definition and Usage

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

The widows property only affects block-level elements.

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

Tip: See the orphans property to set or return the minimum number of lines for an element that must be visible at the bottom of a page.

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The widows property is supported in Internet Explorer, Opera and Chrome.

Note: The widows property is not supported in Firefox or Safari. The property is not supported in IE7 and earlier. IE8 requires a !DOCTYPE. IE9 and later has full support.


Return the widows property:

Set the widows property:"number|initial|inherit"

Property Values

Value Description
number An integer that specifies the minimum number of visible lines. Negative values are not allowed. The default value is 2
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: 2
Return Value: A String, representing the minimum number of lines to print at the top of the page
CSS Version CSS2

Style Object Reference Style Object