From a28c21990e25639b964309ecb6c6cdf8a0a5cb39 Mon Sep 17 00:00:00 2001 From: Dan Burzo Date: Mon, 5 Oct 2020 16:54:16 +0300 Subject: [PATCH] Fixes #110: prevent dangling headings at the end of a page --- templates/default.css | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/templates/default.css b/templates/default.css index 44d580b..6ae4402 100644 --- a/templates/default.css +++ b/templates/default.css @@ -30,6 +30,27 @@ h6 { font-family: var(--alt-font); font-weight: bold; page-break-after: avoid; + page-break-inside: avoid; +} + +/* + Prevent dangling headings at the end of the page. + + See: + + * https://github.com/danburzo/percollate/issues/110 + * https://stackoverflow.com/a/53742871/21613 + */ +h1::after, +h2::after, +h3::after, +h4::after, +h5::after, +h6::after { + content: ''; + display: block; + height: 5rem; + margin-bottom: -5rem; } a { @@ -328,7 +349,7 @@ article:not(:last-of-type) { padding: 0; } -.type--pdf a:not(.no-href):after { +.type--pdf a:not(.no-href)::after { content: ' → ' attr(href) ''; font-size: 0.8em; word-break: break-all;