page-break-margins-003

page break margin handling

WeasyPrint

This browser

Flags
paged
Assertion
When a page break occurs in the vertical margin between sibling block boxes, the used values of the adjoining 'margin-bottom' and 'margin-top' properties are set to '0'.

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 margin handling</title>
 5 <link rel="author" title="Melinda Grant" href="mailto:melinda.grant@hp.com">
 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="When a page break occurs in the vertical margin between sibling block boxes, the used values of the adjoining 'margin-bottom' and 'margin-top' properties are set to '0'.">
 9 <!-- The portion of this assertion relative to the top margin is also tested by allowed-breaks-000-b.  This test uses a tight layout to attempt to prove the bottom margin portion of the assertion and that may mask some defects exposed by allowed-breaks-000-b.
10 -->
11 <meta name="flags" content="paged">
12 <style type="text/css">
13 	html, body {
14                 height: 100%;
15                 margin: 0;
16                 padding: 0;
17     }
18 	body {
19 	    background: red;
20 	}
21 	div {
22         background: white;
23     }
24     #top {
25         height: 100%;
26         margin-bottom: -2in;
27     }
28     div.one {
29 		page-break-before: avoid;
30 		page-break-after: always;
31 		background: white;
32 		height: 2in;
33 		margin-bottom: 2in;
34 	}
35 	div.two {
36         background: white;
37         margin: 2in 0 0 0;
38         height: 100%;
39 }
40 
41 </style>
42 </head>
43 <body>
44 
45     <div id="top">When printed, this test produces two pages of output.  The text below must be displayed on the bottom half of the page. </div>
46 
47 	<div class="one">There must be a page break after this paragraph.  There must be no red on the page.</div>
48 	<div class="two">This text must be at the top of the second page (right below the top margin, not 2 inches below the top margin).  There must be no red on this page.</div>
49 	
50 
51 </body>
52 </html>