Skip to content

Commit a14900b

Browse files
committed
Simulate behavior of manual page breaks from 'print' in 'screen' mode
1 parent b50e48c commit a14900b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

css/sheets-of-paper.css

+34
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,40 @@ html, body {
4141
div.page-break {
4242
page-break-after: always;
4343
}
44+
/* Simulates the behavior of manual page breaks from `print` mode in `screen` mode */
45+
@media screen {
46+
/* Renders the border and shadow at the bottom of the upper virtual page */
47+
div.page-break::before {
48+
content: "";
49+
display: block;
50+
/* Give a sufficient height to this element so that its drop shadow is properly rendered */
51+
height: 0.8cm;
52+
/* Offset the negative extra margin at the left of the non-pseudo element */
53+
margin-left: 0.5cm;
54+
/* Offset the negative extra margin at the right of the non-pseudo element */
55+
margin-right: 0.5cm;
56+
/* Make the bottom area appear as a part of the page margins of the upper virtual page */
57+
background-color: #fff;
58+
/* Show a drop shadow beneath the upper virtual page */
59+
box-shadow: 0 6px 5px rgba(75, 75, 75, 0.2);
60+
}
61+
/* Renders the empty space as a divider between the two virtual pages that are actually two parts of the same page */
62+
div.page-break {
63+
display: block;
64+
/* Assign the intended height plus the height of the pseudo element */
65+
height: 1.8cm;
66+
/* Apply a negative margin at the left to offset the page margins of the page plus some negative extra margin to paint over the border and shadow of the page */
67+
margin-left: -2.5cm;
68+
/* Apply a negative margin at the right to offset the page margins of the page plus some negative extra margin to paint over the border and shadow of the page */
69+
margin-right: -2.5cm;
70+
/* Create the bottom page margin on the upper virtual page (minus the height of the pseudo element) */
71+
margin-top: 1.2cm;
72+
/* Create the top page margin on the lower virtual page */
73+
margin-bottom: 2cm;
74+
/* Let this page appear as empty space between the virtual pages */
75+
background: #eee;
76+
}
77+
}
4478
/* For top-level headings only */
4579
h1 {
4680
/* Force page breaks after */

0 commit comments

Comments
 (0)