body-background-srl-print-ref.html (1002B)
1 <!DOCTYPE html> 2 <style> 3 :root { 4 print-color-adjust: exact; 5 } 6 body { 7 margin: 20px; 8 background: linear-gradient(to bottom, white 0%, white 50%, lightgray 50%, lightgray 100%); 9 padding-bottom: 480px; 10 } 11 @page { 12 size: 800px 600px; 13 margin: 0; 14 } 15 </style> 16 <div style="position:absolute; left:0; top:0; width:200px;"> 17 There should be a right-aligned blue box on the first page, and a 18 right-aligned hotpink box on the second page. 19 The background of the first page is lightgray, and the background of the 20 second page is white. 21 </div> 22 <!-- Right-align with auto left margin. --> 23 <div style="margin-left:auto; width:600px; height:100px; background:blue;"></div> 24 <!-- Retain the inline-start margin in the test by setting the top margin to 25 20px. Cancel out the block-start body margin (shouldn't be repeated on 26 every page) in the test, by setting the left margin to -20px. --> 27 <div style="break-before:page; width:800px; height:100px; margin:20px 0 0 -20px; background:hotpink;"></div>