scroll-snap-type

Enables scroll snapping. sstxm is for horizontal carousels, and sstym is for vertical page snapping.

Class List

ClassCSSDescription
sstnscroll-snap-type: noneDisable scroll snapping
sstxmscroll-snap-type: x mandatoryHorizontal mandatory snap
sstymscroll-snap-type: y mandatoryVertical mandatory snap
sstbmscroll-snap-type: both mandatoryBoth-axis mandatory snap
sstxpscroll-snap-type: x proximityHorizontal proximity snap
sstypscroll-snap-type: y proximityVertical proximity snap
sstbpscroll-snap-type: both proximityBoth-axis proximity snap

Usage Examples

scroll-snap-type is applied to the scroll container, used together with scroll-snap-align on child elements.

<!-- Horizontal carousel -->
<div class="df sstxm oh">
  <div class="fs0 w100p ssas">Slide 1</div>
  <div class="fs0 w100p ssas">Slide 2</div>
  <div class="fs0 w100p ssas">Slide 3</div>
</div>

<!-- Vertical page snap -->
<div class="sstym oh h100vh">
  <section class="h100vh ssas">Section 1</section>
  <section class="h100vh ssas">Section 2</section>
</div>

mandatory vs proximity

TypeBehavior
mandatory스크롤이 끝나면 반드시 스냅 포인트에 정렬됩니다
proximity스냅 포인트 근처일 때만 정렬됩니다