widows
Example
p {
widows: 0;
}@media print {
p {
widows: 3;
orphans: 3;
}
}widows must be a positive integer, and it only matters where content breaks across pages or columns.
Common mistakes
- Expecting
widowsto work on normal scrolling web pages.
Key points
- Print rules with
widowssit inside@media print. widowsis paired withorphansto control both ends of a page break.
Interview questions
What is the difference between widows and orphans?
widows sets the minimum lines at the top of the next page; orphans sets the minimum lines left at the bottom of the previous one.
Does widows work in multi-column layouts?
Yes, in browsers that support it, it also applies when text breaks between columns.