summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2021-09-21 22:45:09 +0200
committerVincent Douillet <vincent@vdouillet.fr>2021-09-21 22:45:09 +0200
commit81ad4a975304cfcbe8eb6e5bcbdbdb2e8bc7f7c7 (patch)
treec34e4f5450266fb4695fd05887cdf290aaa869b6
parentf672eec006097841f288370de0e4d1a06eaae318 (diff)
Add print stylesheet
-rw-r--r--static/css/print.css52
-rw-r--r--templates/base.html1
2 files changed, 53 insertions, 0 deletions
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 @@
<link href="{{ FEED_DOMAIN }}/{% if TAG_FEED_RSS_URL %}{{ TAG_FEED_RSS_URL|format(tag.slug) }}{% else %}{{ TAG_FEED_RSS|format(tag.slug) }}{% endif %}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Tags RSS Feed" />
{% endif %}
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/style.css" />
+ <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/print.css" />
{% endblock head %}
</head>