Skip to content

Commit ac93744

Browse files
authored
Improve print styles (#919)
* Fix image caption border-radius * Fix image caption border-radius * Improve print stylesheet - Close #909 * Update CHANGELOG and history
1 parent 3e37904 commit ac93744

File tree

6 files changed

+457
-9
lines changed

6 files changed

+457
-9
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Unreleased
22

3+
### Enhancements
4+
5+
- Improve print stylesheet by increasing text contrast, removing elements that don't need to be printed, expanding URLs, and reducing amount of blank pages. [#909](https://github.com/mmistakes/minimal-mistakes/issues/909)
6+
37
### Maintenance
48

59
- Remove extra word in comment. [#911](https://github.com/mmistakes/minimal-mistakes/pull/911)

_sass/_page.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
text-align: right;
186186
z-index: 5;
187187
opacity: 0.5;
188-
border-radius: $border-radius 0 $border-radius 0;
188+
border-radius: $border-radius 0 0 0;
189189

190190
@include breakpoint($large) {
191191
padding: 5px 10px;

_sass/_print.scss

+223-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,237 @@
22
PRINT STYLES
33
========================================================================== */
44

5+
@media print {
6+
7+
[hidden] {
8+
display: none;
9+
}
10+
11+
* {
12+
-moz-box-sizing: border-box;
13+
-webkit-box-sizing: border-box;
14+
box-sizing: border-box;
15+
}
16+
17+
html {
18+
font-size: 16px;
19+
margin: 0;
20+
padding: 0;
21+
}
22+
23+
body {
24+
-moz-osx-font-smoothing: grayscale;
25+
-webkit-font-smoothing: antialiased;
26+
background: #fff !important;
27+
color: #000 !important;
28+
font-size: 1rem;
29+
line-height: 1.5;
30+
margin: 0 auto;
31+
text-rendering: optimizeLegibility;
32+
}
33+
34+
h1,
35+
h2,
36+
h3,
37+
h4,
38+
h5,
39+
h6 {
40+
color: #000;
41+
line-height: 1.2;
42+
margin-bottom: 0.75rem;
43+
margin-top: 0;
44+
}
45+
46+
h1 {
47+
font-size: 2.5rem;
48+
}
49+
50+
h2 {
51+
font-size: 2rem;
52+
}
53+
54+
h3 {
55+
font-size: 1.75rem;
56+
}
57+
58+
h4 {
59+
font-size: 1.5rem;
60+
}
61+
62+
h5 {
63+
font-size: 1.25rem;
64+
}
65+
66+
h6 {
67+
font-size: 1rem;
68+
}
69+
70+
a,
71+
a:visited {
72+
color: #000;
73+
text-decoration: underline;
74+
word-wrap: break-word;
75+
}
76+
77+
table {
78+
border-collapse: collapse;
79+
}
80+
81+
thead {
82+
display: table-header-group;
83+
}
84+
85+
table,
86+
th,
87+
td {
88+
border-bottom: 1px solid #000;
89+
}
90+
91+
td,
92+
th {
93+
padding: 8px 16px;
94+
}
95+
96+
img {
97+
border: 0;
98+
display: block;
99+
max-width: 100% !important;
100+
vertical-align: middle;
101+
}
102+
103+
hr {
104+
border: 0;
105+
border-bottom: 2px solid #bbb;
106+
height: 0;
107+
margin: 2.25rem 0;
108+
padding: 0;
109+
}
110+
111+
dt {
112+
font-weight: bold;
113+
}
114+
115+
dd {
116+
margin: 0;
117+
margin-bottom: 0.75rem;
118+
}
119+
120+
abbr[title],
121+
acronym[title] {
122+
border: 0;
123+
text-decoration: none;
124+
}
125+
126+
table,
127+
blockquote,
128+
pre,
129+
code,
130+
figure,
131+
li,
132+
hr,
133+
ul,
134+
ol,
135+
a,
136+
tr {
137+
page-break-inside: avoid;
138+
}
139+
140+
h2,
141+
h3,
142+
h4,
143+
p,
144+
a {
145+
orphans: 3;
146+
widows: 3;
147+
}
148+
149+
h1,
150+
h2,
151+
h3,
152+
h4,
153+
h5,
154+
h6 {
155+
page-break-after: avoid;
156+
page-break-inside: avoid;
157+
}
158+
159+
h1 + p,
160+
h2 + p,
161+
h3 + p {
162+
page-break-before: avoid;
163+
}
164+
165+
img {
166+
page-break-after: auto;
167+
page-break-before: auto;
168+
page-break-inside: avoid;
169+
}
170+
171+
pre {
172+
white-space: pre-wrap !important;
173+
word-wrap: break-word;
174+
}
175+
176+
a[href^='http://']:after,
177+
a[href^='https://']:after,
178+
a[href^='ftp://']:after {
179+
content: " (" attr(href) ")";
180+
font-size: 80%;
181+
}
182+
183+
abbr[title]:after,
184+
acronym[title]:after {
185+
content: " (" attr(title) ")";
186+
}
187+
188+
.page-break,
189+
.page-break-before {
190+
page-break-before: always;
191+
}
192+
193+
.page-break-after {
194+
page-break-after: always;
195+
}
196+
197+
.no-print {
198+
display: none;
199+
}
200+
201+
a.no-reformat:after {
202+
content: '';
203+
}
204+
205+
abbr[title].no-reformat:after,
206+
acronym[title].no-reformat:after {
207+
content: '';
208+
}
209+
210+
.page__hero-caption {
211+
color: #000 !important;
212+
background: #fff !important;
213+
opacity: 1;
214+
215+
a {
216+
color: #000 !important;
217+
}
218+
}
219+
5220
/*
6221
Hide the following elements on print
7222
========================================================================== */
8223

9-
@media print {
10224
.masthead,
11225
.toc,
12226
.page__share,
13227
.page__related,
228+
.pagination,
14229
.ads,
15-
.page__footer {
16-
display: none;
230+
.page__footer,
231+
.author__avatar,
232+
.author__content,
233+
.author__urls-wrapper,
234+
.nav__list,
235+
.adsbygoogle {
236+
display: none !important;
17237
}
18238
}

docs/_docs/18-history.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ permalink: /docs/history/
44
excerpt: "Change log of enhancements and bug fixes made to the theme."
55
sidebar:
66
nav: docs
7-
modified: 2017-03-22T09:47:31-04:00
7+
modified: 2017-03-23T14:32:01-04:00
88
---
99

1010
## Unreleased
1111

12+
### Enhancements
13+
14+
- Improve print stylesheet by increasing text contrast, removing elements that don't need to be printed, expanding URLs, and reducing amount of blank pages. [#909](https://github.com/mmistakes/minimal-mistakes/issues/909)
15+
1216
### Maintenance
1317

1418
- Remove extra word in comment. [#911](https://github.com/mmistakes/minimal-mistakes/pull/911)

docs/_sass/_page.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
text-align: right;
186186
z-index: 5;
187187
opacity: 0.5;
188-
border-radius: $border-radius 0 $border-radius 0;
188+
border-radius: $border-radius 0 0 0;
189189

190190
@include breakpoint($large) {
191191
padding: 5px 10px;

0 commit comments

Comments
 (0)