page-break-before-009

page-break-before avoid

WeasyPrint

This browser

Flags
paged
Assertion
The 'avoid' value of the 'page-break-before' property prevents a page break before the element when possible

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: page-break-before avoid</title>
 5 <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
 6 <link rel="author" title="Tom Clancy" href="mailto:tclancy@revenution.com">
 7 <link rel="help" href="http://www.w3.org/TR/CSS21/page.html#page-break-props">
 8 <link rel="help" href="http://www.w3.org/TR/css3-page/#pg-br-before-after">
 9 <meta name="assert" content="The 'avoid' value of the 'page-break-before' property prevents a page break before the element when possible">
10 <meta name="flags" content="paged">
11 <style type="text/css">
12 	html, body { height: 100%; line-height: 1; font-size: 20px; margin: 0; padding: 0; }
13 	.spacer { height: 50%; }
14 	.backup { margin-top: -3em; }
15 	.start { page-break-before: always; }
16 
17 	p {
18 		margin: 0;
19 		color: blue;
20 		orphans: 1;
21 		widows: 1;
22 		white-space: pre;
23 	}
24 
25 	.avoidBefore {
26 		page-break-before: avoid;
27 	}
28 	.avoidInside {
29 		page-break-inside: avoid;
30 		widows: 3;
31 		orphans: 3;
32 	}
33 
34 </style>
35 </head>
36 <body>
37 	<div class="spacer">
38 		Lines A-L must appear on the 6 pages of this test. The blue text
39 		must accurately describe the page numbers.
40 	</div><div class="spacer backup"></div>
41 	<p>Page&nbsp;1&nbsp;Line&nbsp;A</p>
42 	<p class="avoidBefore">Page&nbsp;1&nbsp;Line&nbsp;B
43 Page&nbsp;1&nbsp;Line&nbsp;C
44 Page&nbsp;2&nbsp;Line&nbsp;D</p>
45 
46 	<div class="spacer start"></div><div class="spacer backup"></div>
47 	<p>Page&nbsp;3&nbsp;Line&nbsp;E
48 Page&nbsp;3&nbsp;Line&nbsp;F
49 Page&nbsp;4&nbsp;Line&nbsp;G</p>
50 	<p class="avoidBefore">Page&nbsp;4&nbsp;Line&nbsp;H</p>
51 
52 	<div class="spacer start">[page 5]</div><div class="spacer backup"></div>
53 	<p class="avoidInside">Page&nbsp;6&nbsp;Line&nbsp;I
54 Page&nbsp;6&nbsp;Line&nbsp;J
55 Page&nbsp;6&nbsp;Line&nbsp;K</p>
56 	<p class="avoidBefore">Page&nbsp;6&nbsp;Line&nbsp;L</p>
57 </body>
58 </html>