<!DOCTYPE html>
<script>
if (window.testRunner)
testRunner.setPrinting();
if (window.internals)
internals.settings.setShouldPrintBackgrounds(true);
</script>
<style>
body { margin: 0; }
</style>
<div style="height:80vh;">
There should be a yellow square at the bottom of the first page, a blue square
at the top of the second page, an orange square at the bottom of the second
page, and another orange square at the top of the third page.
</div>
<!-- Thanks to some subpixel clipping issues in printing, the ref has to be a
bit more complicated than simply placing a 20x40 DIV. We need clipping here
as well... -->
<div style="position:relative; margin:auto; width:20vh; height:140vh; overflow:clip;">
<div style="position:absolute; contain:size; left:-1vh; top:-1vh; width:50vh; height:21vh; background:yellow;"></div>
<div style="position:absolute; contain:size; left:-1vh; top:20vh; width:50vh; height:20vh; background:blue;"></div>
<div style="position:absolute; contain:size; left:-1vh; bottom:-1vh; width:50vh; height:41vh; background:orange;"></div>
</div>