page-break-before

CSS page-break-before Property

The page-break-before property defines page break before the element.

This property cannot be used on an empty <div> or on absolutely positioned elements.

The page-break-before property is replaced by break-before property.

Generally, page breaks are applied to such paged media, as printed books or documents. After breaking a page, the layout finishes on the current page and the elements of the document that remain continue on the next page. You can often meet this in PDF documents.

With the help of the page-break-before property you can define on what page (right or left) the following content must restart. You can use the CSS @media rule to define break styles for printed documents.

类目类目
Initial Valueauto
Applies toBlock-level elements.
InheritedNo.
AnimatableNo.
VersionCSS2
DOM Syntaxobject.style.pageBreakBefore = “Left”;

Syntax

Syntax

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

Use the code example below to define page break before the element:

@media print {
  h2 {
    page-break-before: right;
  }
}

Values

Values

ValueDescription
autoAllows any automatic page break before the element.
avoidAvoids to insert any page break before the element.
alwaysForces to insert any page break before the element.
leftInsert a page break before the element so that the next page is formatted as a left page.
rightInsert a page break before the element 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.


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

扫一扫,反馈当前页面

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