forced-page-breaks-000

forced page breaks

WeasyPrint

This browser

Flags
paged
Assertion
A page break MUST occur in the vertical margin between block boxes if, among the 'page-break-after' and 'page-break-before' properties of all the elements generating boxes that meet at this margin, there is at least one with the value 'always', 'left', or 'right'.

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3 <head>
 4 <title>CSS Test: forced page breaks</title>
 5 <link rel="author" title="Tom Clancy" href="mailto:tclancy@revenution.com">
 6 <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
 7 <link rel="help" href="http://www.w3.org/TR/CSS21/page.html#page-break-props">
 8 <meta name="assert" content="A page break MUST occur in the vertical margin between block boxes if, among the 'page-break-after' and 'page-break-before' properties of all the elements generating boxes that meet at this margin, there is at least one with the value 'always', 'left', or 'right'.">
 9 <meta name="flags" content="paged">
10 <style type="text/css">
11 	@page {
12 		counter-increment: page;
13 		margin: 7%;
14 		@top-right {
15            content: content: "Page " counter(page);
16         }
17 	}
18 	@page :first {
19 		@top-center {
20            content: "This test requires 7 pages";
21         }
22 	}
23 
24 	.breakBefore {page-break-before: always;}
25 	.breakAfter {page-break-after: always;}
26 	
27 	.breakBeforeLeft {page-break-before: left;}
28 	.breakBeforeRight {page-break-before: right;}
29 
30 	.avoidBefore { page-break-before: avoid; }
31 	.avoidAfter { page-break-after: avoid; }
32 	.avoidInside { page-break-inside: avoid; }
33 </style>
34 </head>
35 <body>
36 <div class="avoidInside avoidAfter">
37   <p>This test requires 7 pages.</p>
38 	<p class="breakBeforeLeft avoidAfter">When printed, this sentence should appear by itself on page 2.</p>
39 </div>
40 	<p class="breakBefore breakAfter">This sentence should appear by itself on page 3.</p>
41 	<p class="breakBefore">This sentence should appear on page 4.</p>
42 	<p class="breakAfter">This sentence should also appear on page 4.</p>
43 	<p class="avoidBefore avoidAfter">This sentence should appear by itself on page 5.</p>
44 	<p class="breakBeforeRight">This sentence should appear by itself on page 7. (Page 6 must be blank.)</p>
45 </body>
46 </html>