widows

Term side of the Card.
Topic: Print Styles
Unit title: widows
Categories: Property
Explanation side of the Card

Explanation: The property that sets the minimum number of lines that must be left at the bottom of a page or column when a block of text is broken. It prevents awkward breaks by ensuring a certain number of lines remain on the page.

Browser compatibility:
  • The chrome browser supports this feature starting from version 25.
  • The edge browser supports this feature starting from version 12.
  • The firefox browser does not support this feature
  • The safari browser supports this feature starting from version 1.3.
Availability: Limited

Example

Wrongcss
p {
  widows: 0;
}
Rightcss
@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 widows to work on normal scrolling web pages.

Key points

  • Print rules with widows sit inside @media print.
  • widows is paired with orphans to 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.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy