InteractivityScroll Snap Align

Scroll Snap Align

Controls where the scroll snaps to align with an element.

Widely available

This feature is well established and works across many devices and browser versions.

Chrome
Edge
Firefox
Safari

ssa-cscroll-snap-align: center;
ssa-escroll-snap-align: end;
ssa-nonescroll-snap-align: none;
ssa-sscroll-snap-align: start;

Center

Ensures that the element will snap to the center of the scroll container when scrolling.

Try scrolling through the image container to see how it behaves.
<div class="o-h pb-4 p-r">
<div class="d-f g-6 o-x-s pb-4 sst-x-m">
<div class="fs-0 p-r ssa-c">
<div class="h-40 w-80"></div>
</div>
<div class="fs-0 p-r ssa-c">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-c">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-c">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-c">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-c">
<div class="h-40 w-80"></div>
</div>
</div>
</div>

End

Ensures that the element will snap to the end of the scroll container when scrolling.

Try scrolling through the image container to see how it behaves.
<div class="o-h pb-4 p-r">
<div class="d-f g-6 o-x-s pb-4 sst-x-m">
<div class="fs-0 p-r ssa-e">
<div class="h-40 w-80"></div>
</div>
<div class="fs-0 p-r ssa-e">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-e">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-e">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-e">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-e">
<div class="h-40 w-80"></div>
</div>
</div>
</div>

Start

Ensures that the element will snap to the start of the scroll container when scrolling.

Try scrolling through the image container to see how it behaves.
<div class="o-h pb-4 p-r">
<div class="d-f g-6 o-x-s pb-4 sst-x-m">
<div class="fs-0 p-r ssa-s">
<div class="h-40 w-80"></div>
</div>
<div class="fs-0 p-r ssa-s">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-s">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-s">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-s">
<img class="h-40 w-80" src="/img/coast.jpg" />
</div>
<div class="fs-0 p-r ssa-s">
<div class="h-40 w-80"></div>
</div>
</div>
</div>

Using utility variants

Learn how to override existing utilities based on the user's screen size or other factors, such as hover states.

Responsive design

Target different screen sizes by adding breakpoint prefixes. Styles apply from the specified breakpoint and up.

Target specific viewport sizes with breakpoint prefixes

sm:ssa-[value]
Small≥640px
md:ssa-[value]
Medium≥768px
lg:ssa-[value]
Large≥1024px
xxl:ssa-[value]
Extra Large≥1536px

Hover state variant

Apply styles conditionally when users hover over an element using the h: prefix.

Add the h: prefix to apply styles only when the user hovers over the element.

Syntax:h:ssa-[value]