scroll-margin-top

Adds margin above an element when scrolling via anchor links. Useful for preventing scroll targets from being hidden behind a fixed header.

Class List

Pattern: smt{value}{unit}

ClassCSSDescription
smt0scroll-margin-top: 0No scroll margin
smt8pxscroll-margin-top: 8px8px margin
smt16pxscroll-margin-top: 16px16px margin
smt2remscroll-margin-top: 2rem20px margin
smt4remscroll-margin-top: 4rem40px margin
smt6remscroll-margin-top: 6rem60px margin (typical header height)
smt8remscroll-margin-top: 8rem80px margin
smt10remscroll-margin-top: 10rem100px margin

Usage Examples

<!-- Add scroll margin to anchor link targets -->
<section id="section1" class="smt6rem">
  <h2>Section Title</h2>
  <p>Not obscured below the fixed header (60px).</p>
</section>

<!-- Scroll snap + margin -->
<div class="smt4rem" id="card-1">
  <div class="bg18181B p2rem br8px">Card 1</div>
</div>

Tips & Notes

scroll-margin vs scroll-padding

smt is applied to the scroll target element, while spt is applied to the scroll container. scroll-padding-top is more suitable for fixed header compensation.