-
Notifications
You must be signed in to change notification settings - Fork 0
/
print.less
182 lines (145 loc) · 3.73 KB
/
print.less
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
////////////////////////////////////////////////////////////////////////////////
/// ------------------------------------------------------------------------ ///
/// #PRINT STYLES -- version 2.0.9 -- 03/21/2024 --------------------------- ///
/// ------------------------------------------------------------------------ ///
/// Append these styles to the bottom of your stylesheet and make any ///
/// changes necessary to your project from there. Minimizing the total ///
/// number of linked CSS files is recommended for reducing page load speed ///
/// as it minimizes the amount of HTTP requests. ///
/// ------------------------------------------------------------------------ ///
////////////////////////////////////////////////////////////////////////////////
@media print {
// Eliminate all the color and shadow on the page
*,
:before,
:after {
background: #fff !important;
background: transparent !important;
color: #000 !important;
box-shadow: none !important;
text-shadow: none !important;
}
// Specify a default `size` of page and a min-width on `<body>` to make
// printing closer across browsers.
@page {
size: a3;
}
// We don't set page margins inside body normally because explicit margins
// will break break the above `size` in Webkit, but Firefox and IE and legacy
// Edge do not support the `size` property, so we set margins there using
// Firefox and IE targeting hacks.
body {
font-size: 12pt;
line-height: 1.5;
text-rendering: optimizeLegibility;
// Target Mozilla Firefox
@-moz-document url-prefix() {
margin: 1in;
}
// Target IE 9 - 11 and legacy Edge
@media (min-width: 0\0) and (min-resolution: +72dpi) {
margin: 1in;
}
}
body,
.container {
min-width: 992px !important;
}
header:has(nav),
nav,
aside,
footer {
display: none !important;
}
// Underline links and avoid printing link URLs
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: none !important;
}
// Don't show links that are fragment identifiers,
// or use the `javascript:` pseudo protocol
a[href^='#']:after,
a[href^='javascript:']:after {
content: '';
}
dfn[title],
abbr[title],
acronym[title] {
border-bottom: none;
text-decoration: none;
&:after {
content: ' (' attr(title) ')';
}
}
pre {
white-space: pre-wrap !important;
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
break-inside: avoid;
}
// Avoid page orphans/widows and page breaking after a header
p,
h2,
h3,
h4 {
orphans: 3;
widows: 3;
}
h1,
h2,
h3,
h4 {
page-break-after: avoid;
}
// Scale down large headings
h1 { font-size: 20pt; }
h2 { font-size: 18pt; }
h3 { font-size: 16pt; }
h4 { font-size: 14pt; }
h5 { font-size: 12pt; }
h6 { font-size: 10.5pt; }
// Printing Tables:
// https://web.archive.org/web/20180815150934/http://css-discuss.incutio.com/wiki/Printing_Tables
table {
max-width: 100%;
border-collapse: collapse;
}
thead {
display: table-header-group;
}
// Add borders and padding for clarity
th,
td {
padding: 8px;
border: 1px solid #ddd;
text-indent: 0;
}
// Avoid page breaking inside table rows or images
tr,
img {
page-break-inside: avoid;
break-inside: avoid;
}
// Ensure images don't overflow the page
img {
max-width: 100%;
max-height: 100%;
}
[aria-hidden='true'] {
display: none !important;
}
// Utilitiy classes for marking things for printing or not printing
.no-print,
.no-print * {
display: none !important;
}
.print {
display: block !important;
}
}