scroll-margin-top
does not seem to work properly when the element with scroll-margin-top
has overflow: hidden
.
section {
scroll-margin-top: 3rem; /* height of sticky nav at top of page */
overflow: hidden;
}
Why does overflow: hidden
interfere with scroll-margin-top
? Is there any way to use both properties on the same element at the same time?
My problem was that the elements to which I had assigned the scroll-margin-top
were sometimes in a container with overflow: hidden
. As soon as the element is at the top and thus the scroll-margin
protrudes from this container, the scroll-margin
is also cut off by the overflow: hidden
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With