Created
August 18, 2017 20:56
-
-
Save conorbarclay/8ca4b5f157b9795288785f8bd280b17e to your computer and use it in GitHub Desktop.
Starter print-friendly SCSS partial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media print { | |
* { | |
&:before, | |
&:after { | |
background: transparent !important; | |
color: $black !important; // Black prints faster | |
text-shadow: none !important; | |
box-shadow: none !important; | |
} | |
} | |
a { | |
&[href] { | |
&:after { | |
content: ' (" attr(href) ")'; // this prints the url after the link text | |
} | |
} | |
// Don't show links for fragment identifiers, or :tel links | |
&[href^='tel'], | |
[href^='#'] { | |
&:after { | |
content: ''; | |
} | |
} | |
&:visited { | |
text-decoration: underline; | |
} | |
} | |
abbr { | |
&[title] { | |
&:after { | |
content: ' (" attr(title) ")'; | |
} | |
} | |
} | |
pre, | |
blockquote { | |
border: 1px solid $black; | |
page-break-inside: avoid; | |
} | |
thead { | |
display: table-header-group; | |
} | |
tr, | |
img { | |
page-break-inside: avoid; | |
} | |
img { | |
max-width: 100% !important; // Avoid images bleeding off the edges of the page | |
} | |
p, | |
h2, | |
h3 { | |
orphans: 3; | |
widows: 3; | |
} | |
h2, | |
h3 { | |
page-break-after: avoid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment