CSS Reference ยท Multi-column and Fragmentation
The break-before property
Reference for the CSS break-before property: force or avoid a page, column or region break before an element, with live multi-column examples and notes.
The break-before property controls whether a page, column or region break may, must or must not happen directly before an element. Breaks only exist in fragmented contexts: printed pages, multi-column containers and similar. On a normal scrolling screen the property has no effect.
Use it to start every chapter on a new page when printing, to push a heading to the top of the next column, or to keep a heading from being stranded at the bottom of a column.
h2 { break-before: page; } .new-column { break-before: column; } h3 { break-before: avoid; }
Try it
Without the orange rule, all six boxes would fill the first column and continue in the next. With it, boxes 3 and 5 always begin a column.
Syntax
break-before: 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 before the box, whatever the kind of fragmentation. |
avoid-page, avoid-column, avoid-region |
Avoid a break of that specific kind. |
page |
Always break to a new page before the box. |
left, right |
Break to a new page, so that the box starts on a left or right page. |
recto, verso |
Like right and left, but following the writing direction (front or back side of a sheet). |
column |
Always break to a new column before the box. |
region |
Always break to a new region (a feature that has little browser use today). |
always, all |
Force a break at the innermost fragmentation context (always) or in every context (all). Support is limited, so prefer page or column. |
Usage notes
avoidis a request, not a command. If keeping boxes together is impossible (for example the content is taller than a page), the browser breaks anyway.- Forced breaks win over avoid rules. If one side asks for a break and the other asks to avoid it, the forced break is used.
- Test in print preview. Page breaks are visible only when printing or saving as PDF. Use your browser's print preview to check them.
- Do not use it on screen for layout. To control where things go on a screen, use grid or flexbox. Breaks are about splitting content across fragments.
- Legacy names.
page-break-beforeis the old name; browsers still accept it as an alias for the page values. - Margins at a break. The margin at a forced break is kept; at an unforced break it is usually truncated.
Browser support
The page, left, right, avoid and avoid-page values are widely supported for printing. Support for column, avoid-column and the region values varies between browsers; check a compatibility table before depending on them.
Related
break-afterโ breaks after a boxbreak-insideโ breaks inside a boxorphansandwidowsโ lines at a break@pageโ page boxes for printing- Lesson: Print Styles, Multi-column Layout