Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

widows — minimum lines after a break

The `widows` property sets the minimum number of a block’s lines to keep together after a page or column break. It constrains fragmentation, not ordinary text wrapping.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

widows: <integer [1,∞]>;

widows applies to block containers that establish an inline formatting context. It sets the minimum number of line boxes in the block’s fragment after a fragmentation break, such as on the next page or in the next column. It does not control ordinary text wrapping.

The initial value is 2, and the property is inherited. It accepts a positive integer and CSS-wide keywords. 0 and negative integers invalidate the declaration. orphans constrains lines before the break; widows constrains lines after it.

If the entire block has fewer lines than the required minimum, it should stay together. This is not an unconditional guarantee: forced breaks take precedence, and the browser can relax line-count constraints when allowed break points are insufficient to prevent overflow.

The example creates six explicit lines and a column with room for five. With widows: 3, the expected split is three lines in each column rather than five and one. This is an expectation for local verification, not an executed test result.

Examples

<!doctype html>
<meta charset="utf-8">
<title>widows</title>
<style>
  .columns {
    width: 420px;
    height: 100px;
    column-count: 2;
    column-gap: 20px;
    column-fill: auto;
    font: 16px / 20px monospace;
  }
  p {
    margin: 0;
    orphans: 1;
    widows: 3;
  }
</style>
<div class="columns">
  <p>Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</p>
</div>

Result

Expected layout: lines 1–3 in the first column and lines 4–6 in the second. With widows: 1 instead, the expected split is lines 1–5 and line 6.

The output describes the expected layout for you to check locally, not the result of a test run.

Sources