CSS Reference ยท Multi-column and Fragmentation
The break-after property
Reference for the CSS break-after property: force or avoid a page or column break after an element, keep headings with their text, with live examples.
The break-after property controls whether a page, column or region break may, must or must not happen directly after an element. It is the mirror of break-before, and like it, it only matters in fragmented contexts such as printing and multi-column layout.
Two uses are by far the most common: break-after: avoid on headings, so a heading is never left alone at the bottom of a page or column, and break-after: page on a cover or section to make the next content start on a fresh page.
h2, h3 { break-after: avoid; } .cover { break-after: page; }
Try it
Each orange box is the last box of its group. The column ends right after it, so every group gets a column of its own, even though there would be room for more.
Syntax
break-after: auto | avoid | always | all
| avoid-page | page | left | right | recto | verso
| avoid-column | column
| avoid-region | region;
- Initial value:
auto - Applies to: block-level boxes, grid items, flex items, table row groups and table rows
- Inherited: no
- Animatable: no (discrete)
- Computed value: as specified
Values
| Value | Description |
|---|---|
auto |
Neither forces nor forbids a break. The default. |
avoid |
Avoid any break after the box. |
avoid-page, avoid-column, avoid-region |
Avoid a break of that specific kind. |
page |
Always start a new page after the box. |
left, right |
Start the next content on the next left or right page. |
recto, verso |
Like right and left, but following the writing direction. |
column |
Always start a new column after the box. |
region |
Always start a new region after the box. |
always, all |
Force a break in the innermost (always) or every (all) fragmentation context. Prefer page or column, which are better supported. |
Usage notes
- Headings first.
break-after: avoidon headings is the single most useful declaration in a print stylesheet. A heading with no text beneath it looks like a mistake. - A forced break after the last box. A
pagebreak after the final element can produce an empty page in some browsers. Put the rule on elements that are followed by more content. - Only the boundary counts. Break rules apply between siblings or between a box and its last or first child. A rule on a nested box can be overridden by the parent's own break rules.
- Avoid is a hint. When the content cannot fit, browsers ignore
avoidrather than overflow. - Old alias.
page-break-afteris the legacy name and still works for page breaks. - Screen vs print. On screen with no columns, nothing is fragmented and the property is invisible. Check with print preview.
Browser support
page, avoid and the left and right values are widely supported for printing. Support for column and the region values differs between browsers; check a compatibility table before relying on them.
Related
break-beforeโ breaks before a boxbreak-insideโ breaks inside a boxorphansandwidowsโ lines at a break- Lesson: Print Styles, Multi-column Layout