I have never seen before like the following (seen in bootstrap template):
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
So, what are the orphans and widows for?
The orphans CSS property sets the minimum number of lines in a block container that must be shown at the bottom of a page, region, or column. In typography, an orphan is the first line of a paragraph that appears alone at the bottom of a page.
The Non-Breaking Space One of my favorite ways to prevent widows in web layouts has been to add a non-breaking space between the last two words of a line so they're forced to stay together if anything wraps. This way, the words lazy and dog will be visually separated but functionally glued together.
Widow: A paragraph-ending line that falls at the beginning of the following page or column, thus separated from the rest of the text. (They have a past but no future.) Orphan: A paragraph-opening line that appears by itself at the bottom of a page or column, thus separated from the rest of the text.
Widow/Orphan control Widows and orphans are single lines of text in a paragraph that print at the top or bottom of a text box or column. To prevent widows and orphans by always having at least two lines of text at the top or bottom of a text box, select the Widow/Orphan control check box.
In typography, a “widow” is the last line of a paragraph that appears at the start of a new page, and an “orphan” is the first line of a paragraph that appears at the end of a page. So both are single lines that have been isolated from the rest of the paragraph by a page break. They are regarded as avoidable, though opinions disagree on how serious the problems are.
The CSS concepts are generalizations of the typographic concepts, replacing “the last line” by “the last few lines” and “the first line” by “the first few lines”. These generalizations are not particularly useful; there is generally nothing wrong with having two (or three or...) lines of a paragraph on a page other than the rest of the paragraph.
The definitions of the CSS properties are somewhat unnatural, since e.g. orphans: 4
does not mean four orphans anywhere. Instead, it says that less than 4 lines of a paragraph at the end of a page be considered an orphan and be avoided. It is rather difficult to find use for such a setting.
The initial value of both properties is 2, which thus means that the single line orphans and widows (i.e., orphans and widows in the typographic sense) are to be avoided.
So why would you set those properties? Normally only as orphans: 1
or widows: 1
or both, to specify that typographic orphans or widows need not be avoided. It’s difficult to find use cases even for these.
The example in the question thus means that a page break may not appear inside a p
, h2
, or h3
element, unless at least 3 lines of it appear on each page. So a 5-line paragraph may not be broken across two pages at all, and 6-line paragraph may only be broken as 3 and 3 lines. This sounds pointlessly excessive. For headings, it should cause no harm, since a heading normally fits on one line – but the setting is pointless for headings, since even the defaults prevent a 2- or 3-line heading from being broken (and a heading longer than 3 lines is really anomalous).
Quoting from moz.com
orphans: <integer>
widows: <integer>
These two properties are used primarily in paged media to control line breaks by specifying the number of lines in a paragraph that should be left at the top (widows) or bottom (orphans) of a page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With