page-break-after property

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

CSS 2.1, Section 13.3.1Internet Explorer 9

 

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

Internet Explorer 8. Forbid a page break after the object, if possible.

empty string

Behaves the same as auto.

inherit

Internet Explorer 8. 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 Valueauto

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 example uses the page-break-after property to start printing on a new page.

Setting page-break-after to always for the p element specifies that a page break occurs at the end of each paragraph.

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


<!DOCTYPE html>
<html>
<head>
   <style type="text/css">
      P {
         page-break-after: always;
      }
   </style>
</head>
<body>
   <p>Because page-break-after is set to always, there will be a page break after this first paragraph when you print this page.</p>
   <p>This second paragraph prints on the next page.</p>
</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

 

 

Show:
© 2014 Microsoft