LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. Scroll effects

Scroll snap

Also called CSS scroll snap or snap scrolling

A CSS feature that makes a scroll container settle on set points, so carousels and full-screen sections come to rest neatly on an item.

const testimonials = [
  {
    name: 'Maya Chen',
    role: 'Founder, Fieldnote',
    quote: 'We went from idea to paying customers in a weekend.'
  },
  {
    name: 'Daniel Ortiz',
    role: 'Ops lead, Northwind',
    quote: 'Our internal tools finally look like real products.'
  },
  {
    name: 'Priya Nair',
    role: 'Designer, Lumen',
    quote: 'I describe a screen and see it running a minute later.'
  },
  {
    name: 'Tom Becker',
    role: 'CTO, Parcel & Co',
    quote: 'Publishing to our own domain took one click.'
  }
];

export function TestimonialCarousel() {
  return (
    // snap-mandatory: every swipe comes to rest on a card. scroll-px-6 lines cards up with the page margin.
    <ul
      aria-label='Customer testimonials'
      className='flex snap-x snap-mandatory scroll-px-6 gap-4 overflow-x-auto overscroll-x-contain px-6 pb-4'
    >
      {testimonials.map((item) => (
        // Narrower than the row, so the next card peeks in.
        <li
          key={item.name}
          tabIndex={0}
          className='w-80 max-w-[85%] shrink-0 snap-start rounded-2xl border bg-background p-6 outline-ring focus-visible:outline-2'
        >
          <blockquote className='text-sm'>“{item.quote}”</blockquote>
          <p className='mt-4 text-sm font-medium'>{item.name}</p>
          <p className='text-sm text-muted-foreground'>{item.role}</p>
        </li>
      ))}
    </ul>
  );
}
Make the testimonials row a swipeable carousel with CSS scroll snap: overflow-x: auto and scroll-snap-type: x mandatory on the row, scroll-snap-align: start on each 320px card, 16px gaps, and scroll-padding-inline: 24px so cards line up with the page margin. Let the next card peek in by about 40px, add overscroll-behavior-x: contain, and keep each card focusable so keyboard users can tab through them.

Paste into Layerwise or any AI coding tool.

What is Scroll snap?

Scroll snap lets the browser finish a scroll for you. Swipe a carousel and let go, and it glides to the nearest card, lined up with the edge. It works with touch, trackpads, mouse wheels, and the keyboard, and keeps the natural momentum of each device.

Two properties do the work. On the scroll container, scroll-snap-type: x mandatory turns on snapping along the horizontal axis. On each child, scroll-snap-align: start (or center) marks where it lines up. Add scroll-padding to the container when a header or page margin should stay clear.

Use mandatory for carousels and galleries where every stop should land on an item, and proximity for long pages where snapping should only kick in near a snap point. Let part of the next item peek in so people know there is more, and keep items focusable for keyboard users.

Often confused with

Carousel
A carousel is the component that shows items in a sideways row. Scroll snap is a CSS technique that makes a carousel come to rest on each item.

Related terms

All terms

Carousel

A row of slides shown one at a time and moved with arrows, dots, swipes, or a timer, to fit several images or cards in one spot.

Smooth scrolling

Animated scrolling that glides to a new position, such as the target of an anchor link, so readers can see where on the page they went.

Horizontal scroll section

A pinned section where scrolling down moves a row of cards sideways, turning vertical scrolling into horizontal movement.

Momentum

The glide an element keeps after a throw or flick, slowing down gradually like an object sliding across a smooth table.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.

DownloadDownloadRead the docs
LayerwiseLayerwise

Build full-stack web apps in minutes with AI.

Product

  • Features
  • Pricing
  • Download
  • Templates

Solutions

  • AI Website Builder
  • Vibe Coding
  • Personal Software

Resources

  • Documentation
  • Changelog
  • Blog
  • Vibe Coding Glossary
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact

Legal

  • Privacy
  • Analytics Privacy
  • Terms
  • Security
  • Abuse

© 2026 Layerwise. All rights reserved.

Entrances & exits

  • Fade in
  • Slide in
  • Scale in
  • Pop in
  • Blur in
  • Reveal animation
  • Enter and exit animations

Timing & sequencing

  • Duration
  • Delay
  • Keyframes
  • Tweening
  • Stagger
  • Orchestration
  • Fill mode
  • Stepped animation
  • Looping animation
  • Yoyo animation

Easing

  • Easing
  • Linear easing
  • Ease-in
  • Ease-out
  • Ease-in-out
  • Cubic-bezier
  • Asymmetric easing
  • Overshoot easing

Springs & physics

  • Spring animation
  • Stiffness
  • Damping
  • Mass
  • Bounce
  • Velocity
  • Momentum
  • Interruptible animation
  • Rubber-banding

Transforms

  • Translate
  • Scale
  • Rotate
  • Skew
  • 3D flip
  • Perspective
  • Transform origin
  • Origin-aware animation

State transitions

  • Crossfade
  • Morph
  • Shared element transition
  • Layout animation
  • Height auto animation
  • Direction-aware transition
  • Continuity transition
  • Page transition
  • View Transitions API

Scroll effects

  • Scroll reveal
  • Scroll-driven animation
  • Parallax scrolling
  • Scrollytelling
  • Scroll pinning
  • Horizontal scroll section
  • Scroll progress bar
  • Scroll snap
  • Smooth scrolling

Interaction feedback

  • Hover effect
  • Press feedback
  • Ripple effect
  • Shake animation
  • Hold to confirm
  • Drag gesture
  • Drag to reorder
  • Swipe to dismiss
  • Pull to refresh
  • Magnetic button
  • Custom cursor
  • 3D tilt card
  • Spotlight card

Text effects

  • Typewriter effect
  • Text scramble
  • Split text animation
  • Text morph
  • Rotating words
  • Gradient text
  • Shimmer text
  • Number ticker
  • Tabular numbers
  • Underline animation

Loops & ambient motion

  • Marquee
  • Pulse animation
  • Float animation
  • Orbit animation
  • Idle animation
  • Particle background
  • Border beam
  • Confetti
  • Animated gradient

Visual effects

  • Blur
  • Clip-path
  • Mask
  • Before/after slider
  • SVG line drawing
  • Lottie animation

Motion principles

  • Purposeful animation
  • Anticipation
  • Follow-through
  • Squash and stretch
  • Perceived performance
  • Frequency of use
  • Spatial consistency
  • Reduced motion

Animation performance

  • Frame rate (FPS)
  • Jank
  • GPU acceleration
  • will-change
  • Layout thrashing

Layout

  • Hero section
  • Above the fold
  • Sticky header
  • Sidebar
  • Bento grid
  • Card
  • Flexbox
  • CSS Grid
  • Padding vs margin
  • Responsive design
  • Container
  • Masonry layout
  • Split screen
  • Z-index
  • Overflow

Components

  • Button variants
  • Modal
  • Drawer
  • Popover
  • Tooltip
  • Dropdown menu
  • Context menu
  • Toast notification
  • Tabs
  • Segmented control
  • Accordion
  • Carousel
  • Command palette
  • Combobox
  • Toggle switch
  • Checkbox
  • Radio button
  • Date picker
  • Breadcrumb
  • Pagination
  • Infinite scroll
  • Badge
  • Avatar stack
  • Empty state
  • Skeleton screen
  • Spinner
  • Progress bar
  • Data table
  • Stepper
  • Floating label
  • Inline validation
  • Alert banner
  • Tag input

States & patterns

  • Interaction states
  • Focus ring
  • Loading state
  • Optimistic UI
  • Debounce
  • Lazy loading
  • Dark mode
  • Micro-interaction
  • Affordance
  • Undo
  • Drag and drop
  • Keyboard shortcut

Visual styles

  • Glassmorphism
  • Liquid glass
  • Neumorphism
  • Claymorphism
  • Neo-brutalism
  • Skeuomorphism
  • Flat design
  • Mesh gradient
  • Aurora background
  • Grain texture
  • Glow effect
  • Drop shadow
  • Border radius
  • Grid background
  • Typographic hierarchy
  • Accent color
  • Color contrast

Vibe coding & AI

  • Vibe coding
  • Prompt
  • Context window
  • Token
  • AI agent
  • Tool call
  • Hallucination
  • Diff
  • Live preview
  • Checkpoint
  • Git commit
  • Deploy
  • Frontend and backend
  • API
  • Database
  • Rules file
  • MCP
  • Plan mode
  • Visual edit

scroll-snap-type: x mandatory

Snow-covered Ama Dablam rising above a mountain range in NepalMountains
Turquoise surf breaking on a sandy shore, seen from aboveCoast
A sand dune ridge under a clear blue skyDesert
Fog drifting over a forested valleyForest
Neon signs glowing over a city street at nightCity
Mountains and pine trees reflected in a still lakeLakes

No snap

Snow-covered Ama Dablam rising above a mountain range in NepalMountains
Turquoise surf breaking on a sandy shore, seen from aboveCoast
A sand dune ridge under a clear blue skyDesert
Fog drifting over a forested valleyForest
Neon signs glowing over a city street at nightCity
Mountains and pine trees reflected in a still lakeLakes