allowed-page-breaks-001a

allowed page breaks between blocks

WeasyPrint

This browser

Flags
paged
Assertion
Unforced breaking in the vertical margin between sibling block boxes is allowed only if the 'page-break-after' and 'page-break-before' properties of all the elements generating boxes that meet at this margin are 'auto' and the common ancestors of all the elements do not have a 'page-break-inside' value of 'avoid'.

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: allowed page breaks between blocks</title>
 5 <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
 6 <link rel="help" href="http://www.w3.org/TR/CSS21/page.html#page-break-props">
 7 <link rel="help" href="http://www.w3.org/TR/css3-page/#allowed-pg-brk">
 8 <meta name="assert" content="Unforced breaking in the vertical margin between  sibling block boxes is allowed only if the 'page-break-after' and  'page-break-before' properties of all the elements generating boxes  that meet at this margin are 'auto' and the common ancestors of all  the elements do not have a 'page-break-inside' value of 'avoid'.">
 9 <meta name="flags" content="paged">
10 <style type="text/css">
11 	html, body { height: 100%; line-height: 1; font-size: 20px; margin: 0; padding: 0; }
12 	.spacer { height: 50%; }
13 	.backup { margin-top: -1em; }
14 	.start { page-break-before: always; }
15 
16 	p {
17 		margin: 0;
18 		color: blue;
19 	}
20 
21 	.avoidBefore { page-break-before: avoid; }
22 	.avoidAfter	{ page-break-after:	avoid; }
23 	.avoidInside { page-break-inside: avoid; }
24 	.allowInside { page-break-inside: auto; }
25 </style>
26 </head>
27 <body>
28 	<div class="spacer">
29 		Lines A-Z must appear on the 18 pages of this test. The blue text
30 		must accurately describe the page numbers.
31 	</div><div class="spacer backup"></div>
32 	<div class="avoidInside">
33 		<p>Page&nbsp;2&nbsp;Line&nbsp;A</p>
34 		<p>Page&nbsp;2&nbsp;Line&nbsp;B</p>
35 	</div>
36 
37 	<div class="spacer start">
38 		<p>Page&nbsp;3&nbsp;Line&nbsp;C</p>
39 	</div><div class="spacer backup"></div>
40 	<div class="avoidInside"><div><div><div><div><div><div class="allowInside">
41 		<p>Page&nbsp;4&nbsp;Line&nbsp;D</p>
42 		<p>Page&nbsp;4&nbsp;Line&nbsp;E</p>
43 	</div></div></div></div></div></div></div>
44 
45 	<div class="spacer start">
46 		<p>Page&nbsp;5&nbsp;Line&nbsp;F</p>
47 	</div><div class="spacer backup"></div>
48 	<div class="allowInside">
49 		<p>Page&nbsp;5&nbsp;Line&nbsp;G</p>
50 		<p>Page&nbsp;6&nbsp;Line&nbsp;H</p>
51 	</div>
52 
53 	<div class="spacer start">
54 		<p>Page&nbsp;7&nbsp;Line&nbsp;I</p>
55 	</div><div class="spacer backup"></div>
56 	<p class="avoidAfter">Page&nbsp;8&nbsp;Line&nbsp;J</p>
57 	<p>Page&nbsp;8&nbsp;Line&nbsp;K</p>
58 
59 	<div class="spacer start">
60 		<p>Page&nbsp;9&nbsp;Line&nbsp;L</p>
61 	</div><div class="spacer backup"></div>
62 	<p>Page&nbsp;10&nbsp;Line&nbsp;M</p>
63 	<p class="avoidBefore">Page&nbsp;10&nbsp;Line&nbsp;N</p>
64 
65 	<div class="spacer start">
66 		<p>Page&nbsp;11&nbsp;Line&nbsp;O</p>
67 	</div><div class="spacer backup"></div>
68 	<div class="avoidAfter"><div>
69 		<p>Page&nbsp;12&nbsp;Line&nbsp;P</p>
70 	</div></div>
71 	<p>Page&nbsp;12&nbsp;Line&nbsp;Q</p>
72 
73 	<div class="spacer start">
74 		<p>Page&nbsp;13&nbsp;Line&nbsp;R</p>
75 	</div><div class="spacer backup"></div>
76 	<p>Page&nbsp;14&nbsp;Line&nbsp;S</p>
77 	<div class="avoidBefore"><div>
78 		<p>Page&nbsp;14&nbsp;Line&nbsp;T</p>
79 	</div></div>
80 
81 	<div class="spacer start">
82 		<p>Page&nbsp;15&nbsp;Line&nbsp;U</p>
83 	</div><div class="spacer backup"></div>
84 	<div><div>
85 		<p class="avoidAfter">Page&nbsp;16&nbsp;Line&nbsp;V</p>
86 	</div></div>
87 	<p>Page&nbsp;16&nbsp;Line&nbsp;W</p>
88 
89 	<div class="spacer start">
90 		<p>Page&nbsp;17&nbsp;Line&nbsp;X</p>
91 	</div><div class="spacer backup"></div>
92 	<p>Page&nbsp;18&nbsp;Line&nbsp;Y</p>
93 	<div><div>
94 		<p class="avoidBefore">Page&nbsp;18&nbsp;Line&nbsp;Z</p>
95 	</div></div>
96 </body>
97 </html>