From 81ad4a975304cfcbe8eb6e5bcbdbdb2e8bc7f7c7 Mon Sep 17 00:00:00 2001 From: Vincent Douillet Date: Tue, 21 Sep 2021 22:45:09 +0200 Subject: Add print stylesheet --- static/css/print.css | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ templates/base.html | 1 + 2 files changed, 53 insertions(+) create mode 100644 static/css/print.css diff --git a/static/css/print.css b/static/css/print.css new file mode 100644 index 0000000..afaff43 --- /dev/null +++ b/static/css/print.css @@ -0,0 +1,52 @@ +/* Print stylesheet inspired by https://www.jotform.com/blog/css-perfect-print-stylesheet-98272/ */ +@media print { + /* Page layout */ + #content, #page { + width: 100%; + margin: 0; + float: none; + } + @page { margin: 2cm } + h2.entry-title { margin-bottom: 0 } + + /* Font */ + body { + font: 13pt Arial, sans-serif; + line-height: 1.3; + background: #fff !important; + color: #000; + } + h1 { font-size: 24pt } + h2 { font-size: 18pt } + h3, h4 { + font-size: 14pt; + margin-top: 25px; + } + + /* Page break */ + a, blockquote { page-break-inside:avoid } + h1, h2, h3, h4, h5, h6 { + page-break-after:avoid; + page-break-inside:avoid; + } + img { + page-break-inside:avoid; + page-break-after:avoid; + } + table, pre { page-break-inside:avoid } + ul, ol, dl { page-break-before:avoid } + + /* Link */ + a:link, a:visited, a { + background: transparent; + color: #520; + text-align: left; + } + a[href^=http]:after { content:" <" attr(href) "> " } + $a:after > img { content: "" } + article a[href^="#"]:after { content: "" } + a:not(:local-link):after { content:" <" attr(href) "> " } + + /* Hide stuff that's needed on paper */ + nav, .translations { display: none } +} diff --git a/templates/base.html b/templates/base.html index ee0777b..9e5e9ac 100644 --- a/templates/base.html +++ b/templates/base.html @@ -29,6 +29,7 @@ {% endif %} + {% endblock head %} -- cgit v1.2.3