From 7d7f3aa76239802da003ff12156e4f68a601592b Mon Sep 17 00:00:00 2001 From: Veit Lehmann Date: Thu, 16 Mar 2023 15:23:54 +0100 Subject: [PATCH] feat(content): improve typography spacing --- src/_content-inner.less | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/_content-inner.less b/src/_content-inner.less index 9880a5c..4200873 100644 --- a/src/_content-inner.less +++ b/src/_content-inner.less @@ -1,9 +1,16 @@ @import "_variables.less"; +@line-height: var(--line-height, 1.5); +@margin-base: ~"@{font-size-post} * @{line-height}"; // default font-size: 16px, line-height: 1.5 (1.6875) +@margin-sm: calc(@margin-base / 3); // => 8px (9px) +@margin-md: calc(@margin-base); // => 24px (27px) +@margin-lg: calc(@margin-base / 3 * 5); // => 40px (45px) + font-size: @font-size-post; +line-height: @line-height; .media(sm, { - line-height: 1.7; + --line-height: 1.6875; }); // setup vertical rhythm with `* + *` method @@ -11,13 +18,13 @@ font-size: @font-size-post; margin: 0; + @{reset-selector} { - margin-top: 1em; + margin-top: @margin-md; } + :is(h1, h2, h3, h4, h5, h6) { - margin-top: calc(2.5 * @font-size-post); + margin-top: @margin-lg; } + :is(dt, li) { - margin-top: 0.5em; + margin-top: @margin-sm; } }