CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES
Advertisements

CSS page-break-before Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The page-break-before CSS property insert page breaks before an element when printing a document. This properties applies to block-level elements that generate a box. It won't apply on an empty <p> that won't generate a box.

The following table summarizes the usages context and the version history of this property.

Default value: auto
Applies to: Block-level elements
Inherited: No
Animatable: No. See animatable properties.
Version: CSS 2, 3

Syntax

The syntax of the property is given with:

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

The example below shows the page-break-before property in action.

@media print {
    h1 {
        page-break-before: always;
    }
}

The style rule in the above example sets the page-breaking behavior to always break the page before an <h1> element so that <h1> element always appears at the top of a new page.

Note: The page-break-before property only applicable to the block-level elements in the normal flow of the root element, or table-row elements.


Property Values

The following table describes the values of this property.

Value Description
auto Insert a page break before the element, if necessary. This is default value.
always Always force a page break before the element.
avoid Avoid a page break before the element.
left Forces either one or two page breaks before the element, so that the next page will be a left-hand page.
right Forces either one or two page breaks before the element, so that the next page will be a right-hand page.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element page-break-before property.

Browser Compatibility

The page-break-before property is partially supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 4+
  • Apple Safari 1.2+
  • Opera 7+

Further Reading

See tutorial on: CSS Media Types.

Related properties: page-break-after, page-break-inside.

Advertisements
Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties