page-break-after property

Sets or retrieves a value indicating whether a page break occurs after the object.

CSS 2.1, Section 13.3.1

Syntax

page-break-after: auto | always | avoid | left | right | inherit

Property values

always

Always insert a page break after the object.

auto

Default. Neither force nor forbid a page break after the object.

avoid

Forbid a page break after the object, if possible.

empty string

Behaves the same as auto.

inherit

Inherit the value of the same property for the object's parent.

left

Currently behaves the same as always.

right

Currently behaves the same as always.

CSS information

Applies ToAll elements
Mediavisual
Inheritedno
Initial Value

Standards information

Remarks

This property applies when printing the document. This property does not apply to the br or hr elements.

If there are conflicts between this property and the page-break-before value on the object previously displayed in the browser, the value that results in the largest number of page breaks is used.

Page breaks are not permitted inside positioned objects.

Examples

The following examples use the page-break-after attribute and the page-break-after property to start printing on a new page.

This example uses the p element as a selector in an embedded style sheet to break the page at the end of all paragraphs.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/page-break-after.htm


<html>
<head>
<style type="text/css">
P {
	page-break-after: always;
}
</style>
</head>
<body>
<p>
: 
</p>
</body>
</html>

This example uses a button to turn off the page break after the object that has an ID value of oPrgrph. When the page is printed or previewed, a page break occurs after the first paragraph unless the user clicks the button.


<html>
<body>
<p id="oPrgrph" style="page-break-after: always;">If you print (or preview) this 
page, there will be a page-break after this paragraph, unless you click the button.</p>
<!-- CLICKING ON THIS BUTTON TURNS OFF BREAK -->
<button onclick="oPrgrph.style.pageBreakAfter=''">Turn Off Break</button>
</body>
</html>

See also

CSSStyleDeclaration
currentStyle
runtimeStyle
style
Reference
page-break-inside
page-break-before
Conceptual
CSS How-to - Optimize Pages for Printing Using CSS

 

 

Build date: 10/15/2012

Community Additions

Show:
© 2014 Microsoft