W3docs

CSS break-before Property

The CSS break-before property defines whether any break before the principal box is allowed, avoided or forced. Read about the property and find examples.

The break-before property defines how page or column breaks should behave before the generated box. If the element does not generate a box, the property has no effect. It supports values such as auto, avoid, always, page, column, left, and right.

The page-break-inside, page-break-after and page-break-before properties help to define how a document must appear when printed.

When multiple break properties apply to the same element, forced breaks (page, column, left, right, always) take precedence over avoid breaks. The break-before property applies to the element itself, while break-inside applies to its principal box.

Initial Valueauto
Applies toBlock-level elements.
InheritedNo.
AnimatableDiscrete.
VersionCSS3
DOM Syntaxobject.style.breakBefore = "auto";

Syntax

Syntax of CSS break-before Property

break-before: auto | avoid | always | page | column | left | right | initial | inherit;

Example of the break-before property:

Example of CSS break-before Property with avoid value

<!DOCTYPE html>
<html>
  <head>
    <title>The title of the document</title>
    <style>
      .multicol {
        background-color: #eee;
        padding: 10px;
        column-count: 3;
        column-rule: 2px dotted #ccc;
      }
      .multicol hr {
        break-before: avoid;
      }
    </style>
  </head>
  <body>
    <h2>Break-before example</h2>
    <div class="multicol">
      <h2>Lorem ipsum</h2>
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. </p>
      <hr />
      <h2>Lorem ipsum</h2>
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p>
    </div>
  </body>
</html>

Result

Values of CSS break-before Property

Values

ValueDescription
autoDefault. Allows any break before the principal box.
avoidAvoids any break before the principal box.
alwaysForces a break before the principal box.
pageForces a page break before the principal box.
columnForces a column break before the principal box.
leftForces one or two page breaks before the principal box so that the next page is formatted as a left page.
rightForces one or two page breaks before the principal box so that the next page is formatted as a right page.
initialSets this property to its default value.
inheritInherits this property from its parent element.

Practice

Practice

What does the CSS 'break-before' property do?