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

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

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

Inherited: no

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

Values

The property accepts one of the following constants:

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

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

  • auto: The browser inserts a page break wherever appropriate in the printed version.

  • left: The browser inserts enough page breaks after the element to ensure that the following element always starts at the top of a left-hand page in double-sided printing.

  • right: The browser inserts enough page breaks after the element to ensure that the following element always starts 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 prevents a page break immediately after a heading:

h1, h2, h3, h4, h5, h6 {
 page-break-after: avoid;
}

  

 

 

 

back to top