From b5ca20d7395f28daace72b9ef55e389d5b2a00df Mon Sep 17 00:00:00 2001 From: Joseph Montanaro Date: Tue, 19 Dec 2023 07:51:20 -0800 Subject: [PATCH] further simplify heading links --- src/lib/Heading.svelte | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/lib/Heading.svelte b/src/lib/Heading.svelte index ef3ecef..e1a0d6b 100644 --- a/src/lib/Heading.svelte +++ b/src/lib/Heading.svelte @@ -11,7 +11,8 @@ position: relative; } - .before { + /* shift the anchor link to hang off the left side of the content when there's room */ + .anchor-wrapper { /* slightly overlap the span with the heading so that it doesn't lose its hover state as the cursor moves between them */ position: absolute; @@ -19,15 +20,7 @@ left: -1.25em; @media(max-width: 58rem) { - display: none; - } - } - - .after { - display: none; - - @media(max-width: 58rem) { - display: revert; + position: revert; } } @@ -46,7 +39,7 @@ } /* emphasize anchor link when heading is hovered or when clicked (the latter for mobile) */ - .h:hover a, .before:hover a, .h a:active { + .h:hover a, .anchor-wrapper:hover a, .h a:active { color: var(--accent-color); opacity: 100%; } @@ -61,22 +54,16 @@ - - - - - - - - - - - - - + + + + + + +