-
Notifications
You must be signed in to change notification settings - Fork 1
/
default-page-custom.css
163 lines (150 loc) · 2.95 KB
/
default-page-custom.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* store some string variables */
.shorttitle1 {
string-set: h1-text content(text);
}
.shorttitle2 {
string-set: h2-text content(text);
}
/* left page */
.running-h1-title {
position: running(runningH1Title);
width: var(--running-title-width);
text-overflow: ellipsis;
overflow: hidden;
}
.running-h1-title:before {
content: string(h1-text);
}
@page chapter:left {
@bottom-right {
content: counter(page);
}
@top-left {
content: element(runningH1Title);
white-space: nowrap !important;
}
}
/* right page */
.running-h2-title {
position: running(runningH2Title);
width: var(--running-title-width);
text-overflow: ellipsis;
overflow: hidden;
}
.running-h2-title:before {
/* We would want to write: */
/* content: string(h2-text, start); */
/* However, this is yet unsupported by Paged.js, see https://gitlab.pagedmedia.org/tools/pagedjs/issues/38 */
content: string(h2-text);
}
@page chapter:right {
@bottom-right {
content: counter(page);
}
@top-left {
content: element(runningH2Title);
white-space: nowrap !important;
}
}
/* New chapter page */
@page chapter:first {
@top-left {
content: none;
}
@top-right {
content: none;
}
@bottom-right {
content: counter(page);
}
}
@page :first {
@top-left {
content: none;
}
@top-right {
content: none;
}
@bottom-right {
content: none !important;
}
background-image: var(--front-cover);
background-position: center 80%;
background-size: 35%; /*contain*/
background-repeat: no-repeat;
}
/* Front cover */
.front-cover {
break-after: recto;
}
/* Front page or title page */
.front-page {
counter-reset: page;
}
/* Front matter*/
@page frontmatter:left {
@bottom-right {
content: counter(page, lower-roman);
}
@top-left {
content: element(runningH1Title);
white-space: nowrap !important;
}
}
@page frontmatter:right {
@bottom-right {
content: counter(page, lower-roman);
}
@top-left {
content: element(runningH1Title);
white-space: nowrap !important;
}
}
@page frontmatter:first {
@top-left {
content: none;
}
@top-right {
content: none;
}
@bottom-right {
content: counter(page, lower-roman);
}
}
/* last page or back cover */
.back-cover {
break-before: verso;
}
.pagedjs_page:last-of-type {
background-image: var(--back-cover);
background-position: center;
background-size: contain;
background-repeat: no-repeat;
}
/* page breaks; aka CSS fragmentation */
.level1 {
break-before: recto;
page: chapter;
}
.front-matter-container .level1 {
page: frontmatter;
}
.section > h1, .section > h2, .section > h3, .section > h4, .section > h5, .section > h6 {
break-after: avoid;
}
.footenotes {
break-before: always;
break-after: always;
}
.figure {
break-inside: avoid;
}
/* reset page numbering for main content */
.main .level1:first-child h1 {
counter-reset: page 1;
}
/* do not break captions */
caption {
break-inside: avoid;
break-after: avoid;
}