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 1 Line A</p>
42 <p class="avoidBefore">Page 1 Line B
43 Page 1 Line C
44 Page 2 Line D</p>
45
46 <div class="spacer start"></div><div class="spacer backup"></div>
47 <p>Page 3 Line E
48 Page 3 Line F
49 Page 4 Line G</p>
50 <p class="avoidBefore">Page 4 Line H</p>
51
52 <div class="spacer start">[page 5]</div><div class="spacer backup"></div>
53 <p class="avoidInside">Page 6 Line I
54 Page 6 Line J
55 Page 6 Line K</p>
56 <p class="avoidBefore">Page 6 Line L</p>
57 </body>
58 </html>