asp.net.ph

Skip Navigation Links

page-break-before Attribute | pageBreakBefore Property

CSS Attributes Index   Printing Attributes


Sets or retrieves whether a page break occurs before the object and on which page ( left or right ) the subsequent content should resume.

Syntax


CSS { page-break-before: 'auto' | 'always' | 'left' | 'right' }
Script object.style.pageBreakBefore = sBreak ]

Possible Values


auto Insert a page break before the object only if necessary.
always Always insert a page break before the object.
left Insert one or two page breaks before the object until a blank left page is reached.
right Insert one or two page breaks before the object until a blank right page is reached.

The property is read/write with a default value of auto; the CSS attribute is not inherited.

Remarks

This property applies when printing the document.

If there are conflicts between this property and the pageBreakAfter value on the next object ( as formatted on the canvas ), the value that results in the largest number of page breaks will be used.

Page breaks are not permitted inside positioned objects.

Example

The following examples demonstrate use of inline event handlers to dynamically specify whether to start printing on a new page. Both methods yield the same effect.

The sample below uses H3 as a selector in an embedded stylesheet to break the page before all H3 headings.

<style>
  H3 { page-break-before: always }
</style>
. . .
<body>
<H3>Start New Section on New Page</H3>

This feature requires Microsoft® Internet Explorer® 4.0 or later.

 Show me 

The sample below uses a call to a function to turn off the page break before the object having an id value of "idParagraph". When the page is printed, there is a page break before the first paragraph unless the "Turn off break" button was clicked.

<script language="JavaScript">
function offBreak ( ) {
idParagraph.style.pageBreakBefore="";
}
</script>
</head>
<body>
<button onClick="offBreak ( )">
  Turn off break</button>
<P id="Paragraph" STYLE="page-break-before='always'">
...
</p>

This feature requires Microsoft® Internet Explorer® 4.0 or later.

 Show me 



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note