Tailwind

How to implement Tailwind v4 scroll snap layouts?

March 18, 2026

download ready
Thank You
Your submission has been received.
We will be in touch and contact you soon!

Tailwind v4 scroll snap layouts use snap-x or snap-y to define the scroll axis, snap-mandatory for mandatory snapping, and snap-start, snap-center, or snap-end for child alignment. Combined with overflow-auto or overflow-x-auto and scroll-smooth, this enables carousel-like scrolling or paginated layouts. Utilities like scroll-mt-* help manage anchor link offsets for smooth navigation. All scroll snapping works natively with touch and pointer devices.

Code

<template>
  <div class="snap-x snap-mandatory flex overflow-x-auto scroll-smooth">
    <section class="snap-start flex-shrink-0 w-screen h-64 bg-red-400 text-white flex items-center justify-center">
      Slide 1
    </section>
    <section class="snap-start flex-shrink-0 w-screen h-64 bg-blue-400 text-white flex items-center justify-center">
      Slide 2
    </section>
    <section class="snap-start flex-shrink-0 w-screen h-64 bg-green-400 text-white flex items-center justify-center">
      Slide 3
    </section>
  </div>
</template>
      
Hire Now!

Need Help with Tailwind Development ?

Work with our skilled tailwind developers to accelerate your project and boost its performance.
**Hire now**Hire Now**Hire Now**Hire now**Hire now

How to implement Tailwind v4 scroll snap layouts?

Tailwind v4 scroll snap layouts use snap-x or snap-y to define the scroll axis, snap-mandatory for mandatory snapping, and snap-start, snap-center, or snap-end for child alignment. Combined with overflow-auto or overflow-x-auto and scroll-smooth, this enables carousel-like scrolling or paginated layouts. Utilities like scroll-mt-* help manage anchor link offsets for smooth navigation. All scroll snapping works natively with touch and pointer devices.

Code

<template>
  <div class="snap-x snap-mandatory flex overflow-x-auto scroll-smooth">
    <section class="snap-start flex-shrink-0 w-screen h-64 bg-red-400 text-white flex items-center justify-center">
      Slide 1
    </section>
    <section class="snap-start flex-shrink-0 w-screen h-64 bg-blue-400 text-white flex items-center justify-center">
      Slide 2
    </section>
    <section class="snap-start flex-shrink-0 w-screen h-64 bg-green-400 text-white flex items-center justify-center">
      Slide 3
    </section>
  </div>
</template>