HTML and CSS Reference
In-Depth Information
Table 16-3. ( continued )
Property
Initial Value
Inherited
Description
orphans
2
Yes
Specifies the minimum number of lines of an element
that must be displayed at the bottom of the page.
If fewer lines would be displayed, the whole item is
moved to the next page.
widows
2
Yes
Specifies the minimum number of lines of an element
that must be displayed at the top of a page. If fewer lines
would be displayed, the whole item is moved from
the previous page.
The page-break-before and page-break-after properties accept one of the following values:
auto Leave it up to the browser to decide where to put the page break. This is the default.
always Force a page break before or after the specified element.
avoid Avoid a page break, if possible.
left Force one or two page breaks before or after the specified element, so the next
page is formatted as a left page.
right Force one or two page breaks before or after the specified element, so the next
page is formatted as a right page.
inherit These properties are not inherited by default, so this value can be used to
force the element to take the same value as its parent.
The page-break-inside property accepts only auto , avoid , or inherit .
The orphans and widows properties should be familiar to anyone with a print background. It's generally
considered bad practice in printing to leave only a single line of a paragraph at the top or bottom of a page. By
default, browsers are expected to print at least two lines of a block-level element before and after a page break.
So if, for example, a three-line paragraph appears at the bottom of a page, but there is room for only two lines,
the whole paragraph should be moved to the next page. You can use these properties to change the minimum
number of lines you want to keep together. The value must be a positive integer. The bigger the number you use,
the more uneven your printed pages are likely to look. For example, if you set both orphans and widows to 4 , the
whole of any paragraph with fewer than eight lines will be moved to the next page if there isn't sufficient room for
it at the bottom of the current page.
The easy way to remember which is which is that orphans are the little ones at the bottom, and widows are
the lonely ones at the top.
Tip
Setting page breaks in a print style sheet should be regarded as indicating a desirable outcome, rather than
something that can be relied upon. You have no way of predicting the size of paper that will be used. Also, there
might be conflicting demands of where the page should be broken. It's left up to the browser to decide what is
possible in any given set of circumstances.
 
 
Search WWH ::




Custom Search