CSS Reference ยท Multi-column and Fragmentation
The widows property
Reference for the CSS widows property: set the minimum number of lines of a paragraph carried over to the top of the next page or column, with a live example.
The widows property sets the minimum number of lines of a block that must appear at the top of the next page, column or other fragment after a break. If a paragraph would carry over fewer lines, the browser pulls extra lines from the previous fragment so that enough lines move over together.
A "widow" in typography is a short stub, often a single last line, left alone at the top of a column. Its partner, orphans, prevents stubs at the bottom. Both only have an effect where content is fragmented: printing and multi-column layout.
p { widows: 3; orphans: 3; }
Try it
Each column holds five lines. On the left, the orange paragraph splits after B3 and only B4 reaches the second column: a widow. On the right, widows: 2 pulls B3 along, so the second column starts with two lines.
Syntax
widows: <integer>;
- Initial value:
2 - Applies to: block containers (paragraphs, divs and similar)
- Inherited: yes
- Animatable: not in any useful way
- Computed value: as specified
Values
| Value | Description |
|---|---|
<integer> |
A positive whole number (1 or more) giving the minimum lines to carry to the next fragment. Zero and negative values are invalid. |
Usage notes
- Mind the pair.
widowsandorphanswork together. A paragraph with fewer lines than their sum cannot satisfy both, and the browser then ignores one of the rules. - The default is 2. A lone last line at the top of a column is already avoided. Raise the value for more generous print typography, or set
1to allow any split. - Not about the last line of every paragraph. This property is about page and column breaks, not the last line of a paragraph in a normal flow. For short last lines, look at
text-wrap: prettyinstead. - Inherited. Set it once on
bodyorarticlein print styles and override only where needed. - Does not force breaks. It only changes where an existing break falls.
- Taller content, bigger effect. On a wide printed page, paragraphs break rarely; in narrow multi-column text they break often.
Browser support
Supported in Chromium-based browsers and Safari; check a compatibility table for the current status in Firefox.
Related
orphansโ lines at the bottom of a fragmentbreak-insideโ keep a box wholebreak-beforeandbreak-after- Lesson: Print Styles, Multi-column Layout