break-after

CSS break-after Property

The break-after is a CSS property which defines how any break (page, column) should behave after the generated box. It has four values: auto, avoid, always, all.

Inside a multicol container, which was inside a page container would force a column and page break.

This property is deprecated.

Each element boundary is touched by the three properties below:

  • Break-after, which is the value of the previous element.

  • Break-before, which is the value of the next element.

  • Break inside, which is the value of the containing element.

Apply the rules below, to decide if a break must be done:

If one of the three values above is a forced break value (left, right, always, page, region or column), it has a priority. If more than one of these values is a forced break, the value of the element turned up the latest is used. For example, the break-before value has a priority over the break-after value, and the break-after value has a priority over break-inside value. If one of these three values is an avoid break value (avoid, avoid-page, avoid-column, or avoid-region) such a break will not be applied.

类目类目
Initial Valueauto
Applies toBlock-level elements.
InheritedNo.
Animatablediscrete
VersionCSS3
DOM Syntaxobject.style.breakAfter = “always”;

Syntax

Syntax

break-after: auto | avoid | always | all | initial | inherit;

Example of the break-after property:

<!DOCTYPE html>
<html>
  <head>
    <title>The title of the document</title>
    <style>
      .multicol {
        background-color: #eee;
        padding: 10px;
        /* Safari and Chrome */
        -webkit-column-count: 3;
        -webkit-column-rule: 2px dotted #ccc;
        /* Firefox */
        -moz-column-count: 3;
        -moz-column-rule: 2px dotted #ccc;
        /* CSS3 */
        column-count: 3;
        column-rule: 2px dotted #ccc;
      }
      .multicol hr {
        break-after: column;
      }
    </style>
  </head>
  <body>
    <h2>Break-after property example</h2>
    <div class="multicol">
      <h2>Lorem ipsum</h2>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sagittis, arcu ut pulvinar sollicitudin, enim purus mollis tellus, et porta elit sem in nulla. Integer a magna eget justo convallis porta. Vestibulum lacinia eget leo sed elementum. Quisque dapibus ullamcorper quam, at pretium quam eleifend a. Donec sit amet blandit risus. Nunc tempus tellus vitae nibh pellentesque imperdiet. Ut pulvinar rhoncus velit, ut euismod odio ornare vel.</p>
      <hr>
      <h2>Lorem ipsum</h2>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sagittis, arcu ut pulvinar sollicitudin, enim purus mollis tellus, et porta elit sem in nulla. Integer a magna eget justo convallis porta. Vestibulum lacinia eget leo sed elementum. Quisque dapibus ullamcorper quam, at pretium quam eleifend a. Donec sit amet blandit risus. Nunc tempus tellus vitae nibh pellentesque imperdiet. Ut pulvinar rhoncus velit, ut euismod odio ornare vel.</p>
    </div>
  </body>
</html>

Result

Values

Values

ValueDescription
autoAllows to insert any area (page, column) after the principal box.
avoidAvoids to insert any break after the principal box.
alwaysForces to insert any break.
allForces to insert any break.
initialSets this property to its default value.
inheritInherits this property from its parent element.


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部