Controlling Widows and Orphans
CSS offers a number of other features that help control how Web pages are printed. Unfortunately, only widows and orphans are supported, and only by Opera. I'll give you a quick synopsis, nonetheless.
To control widows and orphans:
- If desired, in the style rule, type orphans: n;, where n is the minimum number of lines that should appear at the bottom of a page.
- If desired, in the style rule, type widows: n;, where n is the minimum number of lines in the element that should appear at the top of a page.
Only Opera supports the orphans and widows properties.
It's a shame that these features are not better supported by other browsers. However, things move so quickly that perhaps by the time you read this, things will have improved.
Note that the page-break-inside property can also help avoid stranded lines. See page 212.
There were a few additional interesting properties for controlling the printed page, including page, size, and marks. These have all been removed from CSS 2.1.
Figure 14.9. Before the widows property was applied, there were one and a quarter lines stranded at the top of page 3.
Figure 14.10. The orphans property controls how many lines can be alone at the bottom of the page; widows determines the minimum number that will be required at the top of a page.
Figure 14.11. After the widows property is applied, the page break is inserted two lines earlier and the result is four lines at the top of page 3.