diff --git a/styles/mixins.scss b/styles/mixins.scss index c4911e6d..195bb92a 100644 --- a/styles/mixins.scss +++ b/styles/mixins.scss @@ -11,8 +11,7 @@ list-style: none; } -@mixin fixAnchorPosition($offset: 0px) { - // Works with scroll-padding-top (see /styles/default.css) +@mixin setHeadingPadding($offset: 0px) { padding-top: calc(var(--dc-header-height, #{$headerHeight}) - #{$offset}); } diff --git a/styles/yfm.scss b/styles/yfm.scss index a69fa05b..dc3ebf52 100644 --- a/styles/yfm.scss +++ b/styles/yfm.scss @@ -110,7 +110,7 @@ // The margin is summed up. So, we need to take 15px away from the header margin-top h1, h2 { - @include fixAnchorPosition(calc(#{$headerMarginTopLarge} - #{$blockMarginBottomMedium})); + @include setHeadingPadding(calc(#{$headerMarginTopLarge} - #{$blockMarginBottomMedium})); margin-bottom: $blockMarginBottomLarge; } @@ -118,7 +118,7 @@ h4, h5, h6 { - @include fixAnchorPosition(calc(#{$headerMarginTopMedium} - #{$blockMarginBottomMedium})); + @include setHeadingPadding(calc(#{$headerMarginTopMedium} - #{$blockMarginBottomMedium})); } // Use 0px for the top offset of the header if it is the first child element, @@ -130,7 +130,7 @@ h5, h6 { &:first-child { - @include fixAnchorPosition(); + @include setHeadingPadding(); } } @@ -169,7 +169,7 @@ & + h4, & + h5, & + h6 { - @include fixAnchorPosition(#{$headerMarginTopLarge}); + @include setHeadingPadding(#{$headerMarginTopLarge}); } }