Scroll-margin-top

👋 FYI, this note is over 6 months old. Some of the content may be out of date.

You know that annoying thing when you’re scrolled to an anchor and the site’s sticky header covers it up?

.heading {
scroll-margin-top: 72px;
}

Browser support: Works natively in Chrome, FF, Edge, Opera. Supported in Safari, but with a non-standard property, scroll-snap-margin-top.


← Back home