style.widows (Property)

Defines the minimum number of lines of a paragraph of text that must be visible at the top of a page when a page break is present. This is most likely to occur when printing documents.


CSS level - 2
DOM level - 2
JavaScript - 1.5
JScript - 5.0
Internet Explorer - 5.0
Netscape - 6.0
Property/method value type:String primitive
JavaScript syntax:-myStyle.widows
CSS syntax:windows: aCount
Argument list:aCountA count of widow lines

Widows and orphans are fragments of text that appear to be formatted incorrectly when a paragraph of text spans a page break.

Windows and orphans are usually controlled together and the usual technique is to specify that an entire paragraph should be kept on the same page. This forces the paragraph to be taken over to the next page in its entirety, even if the flow requires just a single word to be taken over.

The CSS styling controls allow a finer level of control in that you can allow for a paragraph to be split across a page boundary, but specify a lower limit on the number of lines that must be kept on a single page.

This is fine in principle but there can be some contention for the right layout when a very short paragraph is spanning a page break. This will generally be solved simply by forcing the page break to happen before the paragraph causing the whole paragraph to be carried over to the next page.

A widow is that fragment of text that is left at the top of a page when a paragraph encloses a page break. It is the bottom few lines of the paragraph. The integer value in this property controls the minimum number of lines that must be present. This has the effect of moving the page break earlier in the paragraph to satisfy the requirements of the window setting. However, that itself may transgress the setting for the orphan property, leading to the whole paragraph being taken onwards.

See also:style.orphans, style.pageBreakAfter, style.size