Skip to content

Instantly share code, notes, and snippets.

@ThomasRettig
Last active January 21, 2022 08:01
Show Gist options
  • Save ThomasRettig/cd5b9a2fe825d19f54fca9389f6f2510 to your computer and use it in GitHub Desktop.
Save ThomasRettig/cd5b9a2fe825d19f54fca9389f6f2510 to your computer and use it in GitHub Desktop.
CSS stylesheet to enchance print layout
/* --------------------------------------------------------------
Modified version of Hartija CSS Print Framework
License: MIT
Version: 1.0
-------------------------------------------------------------- */
body {
color: #000;
background: #0000;
font-size: 15pt;
line-height: 1.45;
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
}
h1, h2, h3, h4, h5, h6 {
page-break-after: avoid;
}
h1 {
font-size: 19pt;
}
h2 {
font-size: 17pt;
}
h3 {
font-size: 15pt;
}
h4, h5, h6 {
font-size: 14pt;
}
code {
font-family: ui-monospace, Menlo, Consolas, Roboto Mono, Ubuntu Monospace, Noto Mono, Oxygen Mono, Liberation Mono, monospace, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
}
blockquote {
margin: 1.2em;
padding: 1em;
font-size: 12pt;
}
hr {
background-color: #ccc;
}
img {
float: left;
margin: 1em 1.5em 1.5em 0;
max-width: 100% !important;
}
a img {
border: none;
}
a:link, a:visited {
color: #333;
background: #0000;
font-weight: 700;
text-decoration: underline;
}
a:link[href^="http://"]:after, a[href^="http://"]:visited:after {
content: " (" attr(href) ") ";
font-size: 90%;
}
abbr[title]:after {
content: " (" attr(title) ")";
}
a[href^="http://"] {
color: #000;
}
a[href$=".jpg"]:after, a[href$=".jpeg"]:after, a[href$=".gif"]:after, a[href$=".png"]:after {
content: " (" attr(href) ") ";
display: none;
}
a[href^="#"]:after, a[href^="javascript:"]:after {
content: "";
}
table {
text-align: left;
margin: 1px;
}
th {
border-bottom: 1px solid #333;
font-weight: bold;
}
td {
border-bottom: 1px solid #333;
}
th, td {
padding: 4px 10px 4px 0;
}
tfoot {
font-style: italic;
}
caption {
text-align: left;
background: #fff;
margin-bottom: 2em;
}
thead {
display: table-header-group;
}
img, tr {
page-break-inside: avoid;
}
nav, footer {
display: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment