XML technologies / CSS / Advanced websites with CSS / CSS property reference / page-break-before

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

The property page-break-before can insert or suppress a page break before an element in the printed version of a page.

Inherited: no

See also: orphans, page-break-after, page-break-inside, widows

Values

The property accepts one of the following constants:

  • always: A page break is always inserted before the element.

  • avoid: A page break before the element is avoided. This setting ensures that the element is never separated from the preceding element in the printed version of a page.

  • auto: The browser inserts a page break before the element when appropriate in the printed version.

  • left: The browser inserts enough page breaks before the element to make it start at the top of a left-hand page in double-sided printing.

  • right: The browser inserts enough page breaks before the element to make it start at the top of a right-hand page in double-sided printing.

Default value: auto

Compatibility

CSS version: 2

Works in Internet Explorer 4 and later, Netscape 7 and later, Mozilla and Opera. All browsers treat left and right as always.

The value avoid is not correctly supported by Internet Explorer for Windows. To achieve the corresponding effect, use JavaScript to set the property to an empty string ("").

Example

The following style rule inserts enough page breaks before all sections div of the class kapitelanfang to make them appear at the top of a right-hand page in the printed version:

div. kapitelanfang{
 page-break-before: right;
}

  

 

 

 

back to top