allowed-page-breaks-002

allowed page break - line box breaking

WeasyPrint

This browser

Flags
paged
Assertion
Breaking between line boxes is allowed only if the number of line boxes between the break and the start of the enclosing block box is the value of 'orphans' or more, and the number of line boxes between the break and the end of the box is the value of 'widows' or more and the value of the 'page-break-inside' property is 'auto'.

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 break - line box breaking</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="Breaking between line boxes is allowed only if the number of line boxes between the break and the start of the enclosing block box is the value of 'orphans' or more, and the number of line boxes between the break and the end of the box is the value of 'widows' or more and the value of the 'page-break-inside' property is 'auto'.">
 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 	
13 	* {page-break-inside: auto;}
14 	div.spacer {
15 		height: 50%;
16 	}
17 	div.backup {
18 		margin-top: -3em;
19 	}
20 	div.dummy {
21 		width: 0;
22 		page-break-after: always;
23 		color: blue;
24 	}
25 	
26 	div {
27 		widows: 1;
28 		orphans: 1;
29 	}
30 	div#second {orphans: 4;}
31 	div#third {widows: 4;}
32 	div#fourth {page-break-inside: avoid; page-break-after: auto; }
33 </style>
34 </head>
35 <body>
36 	<div class="spacer">This test requires 8 pages. The blue text must
37 		denote accurate page numbers. Lines A-C must appear on this page;
38 		lines D-F must appear on the next page.</div>
39 	<div class="spacer backup"></div>
40 	<div class="dummy">
41 		Page&nbsp;1&nbsp;Line&nbsp;A
42 		Page&nbsp;1&nbsp;Line&nbsp;B
43 		Page&nbsp;1&nbsp;Line&nbsp;C
44 		Page&nbsp;2&nbsp;Line&nbsp;D
45 		Page&nbsp;2&nbsp;Line&nbsp;E
46 		Page&nbsp;2&nbsp;Line&nbsp;F
47 	</div>
48 	<div class="spacer">Lines G-L must appear on the next page.</div>
49 	<div class="spacer backup"></div>
50 	<div class="dummy" id="second">
51 		Page&nbsp;4&nbsp;Line&nbsp;G
52 		Page&nbsp;4&nbsp;Line&nbsp;H
53 		Page&nbsp;4&nbsp;Line&nbsp;I
54 		Page&nbsp;4&nbsp;Line&nbsp;J
55 		Page&nbsp;4&nbsp;Line&nbsp;K
56 		Page&nbsp;4&nbsp;Line&nbsp;L
57 	</div>
58 	<div class="spacer">Lines M-N must appear on this page; lines O-R on the next page.</div>
59 	<div class="spacer backup"></div>
60 	<div class="dummy" id="third">
61 		Page&nbsp;5&nbsp;Line&nbsp;M
62 		Page&nbsp;5&nbsp;Line&nbsp;N
63 		Page&nbsp;6&nbsp;Line&nbsp;O
64 		Page&nbsp;6&nbsp;Line&nbsp;P
65 		Page&nbsp;6&nbsp;Line&nbsp;Q
66 		Page&nbsp;6&nbsp;Line&nbsp;R
67 	</div>
68 	<div class="spacer">Lines S-X must appear on the next page.</div>
69 	<div class="spacer backup"></div>
70 	<div class="dummy" id="fourth">
71 		Page&nbsp;8&nbsp;Line&nbsp;S
72 		Page&nbsp;8&nbsp;Line&nbsp;T
73 		Page&nbsp;8&nbsp;Line&nbsp;U
74 		Page&nbsp;8&nbsp;Line&nbsp;V
75 		Page&nbsp;8&nbsp;Line&nbsp;W
76 		Page&nbsp;8&nbsp;Line&nbsp;X
77 	</div>
78 </body>
79 </html>