Skip to content

Commit

Permalink
nicer style rules for margin around footnote defs
Browse files Browse the repository at this point in the history
previous implementation used `:not(.fd) + .fd` and `.fd + :not(.fd)`.
the latter selector caused many problems:
- it doesn't select footnote defs which are last children
  (this can be easily triggered in a blockquote)
- it changes the margin of the next sibling, rather than the footnote def
  itself, which can also *shrink* margin for elements with big margins
  (this happens to headings)
- because it applies to the next sibling it is also quite hard to
  override in user styles, since it may apply to any element
  
this commit replaces the latter selector with `:not(:has(+ .fd))`,
which fixes all of the mentioned problems.
  • Loading branch information
WaffleLapkin committed Jan 21, 2025
1 parent 35ed24c commit 64cca13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/theme/css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,12 @@ sup {
line-height: 0;
}

:not(.footnote-definition) + .footnote-definition,
.footnote-definition + :not(.footnote-definition) {
:not(.footnote-definition) + .footnote-definition {
margin-block-start: 2em;
}
.footnote-definition:not(:has(+ .footnote-definition)) {
margin-block-end: 2em;
}
.footnote-definition {
font-size: 0.9em;
margin: 0.5em 0;
Expand Down

0 comments on commit 64cca13

Please sign in to comment.