CSS Scroll Snap Generator — Live Examples & Code

Generate CSS scroll snap code instantly. Tweak snap type, alignment, and scroll behaviour with live demos, then copy as CSS or Tailwind. Compare mandatory vs proximity, then see how fullPage.js takes snapping further.

CSS Scroll Snap Code Generator

Tweak snap type, alignment, section height and scroll behaviour, then copy the generated HTML, CSS or Tailwind CSS code. No JavaScript needed.

Section 1

Scroll down. The viewport snaps to each section after you stop scrolling.

Section 2

Toggle the snap mode to feel the difference between mandatory and proximity.

Section 3

Change Snap Align to start, center, or end to shift where each section locks.

Section 4

Enable Allow free scroll to let the user skip sections in one gesture.

Section 5

All pure CSS. No JavaScript needed for the snapping behaviour.

When to snap?
Snap Align
Section Height

Shrink to see Snap Align in action.

Allow free scroll?

Off → scroll-snap-stop: always

Scroll smoothly?

On → scroll-behavior: smooth

fullPage.js only

Horizontal Scroll Snap Generator

Generate a horizontally snapping carousel with scroll-snap-type: x mandatory. Each item uses scroll-snap-align: start and flex-shrink: 0; width: 100%. Swipe or drag horizontally inside the demo, then copy the code.

Slide 1

Swipe left to scroll. The viewport snaps to each slide.

Slide 2

Horizontal snap, great for carousels and mobile galleries.

Slide 3

Each item is width: 100% with flex-shrink: 0.

Slide 4

Change snap type to proximity for a less aggressive snap.

Slide 5

Zero JavaScript required for this horizontal slider.

When to snap?
Snap Align
Slide Width

Shrink to see Snap Align in action.

Allow free scroll?

Off → scroll-snap-stop: always

Scroll smoothly?

On → scroll-behavior: smooth

fullPage.js only

Want more control?

These features aren't possible with CSS scroll snap, but they work out of the box with fullPage.js.

How CSS Scroll Snap Works

CSS scroll snap is controlled by three main properties: scroll-snap-type on the scroll container, scroll-snap-align on each snap target, and optionally scroll-snap-stop to prevent skipping.

/* Container */
.scroll-container {
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory; /* or: y proximity */
}

/* Each snap target */
.section {
  height: 100vh;
  scroll-snap-align: start; /* or: center, end */
}

/* Prevent skipping sections (optional) */
.section {
  scroll-snap-stop: always;
}

mandatory vs proximity

mandatory means the browser will always snap to a snap point after scrolling ends, regardless of where the scroll stopped. This creates a fullscreen-section feel; you can never rest between sections.

proximity means the browser only snaps if the final scroll position is close to a snap point (within about 50% of the snap target's size). The user can stop between sections if they scroll far enough from any snap point. Better for pages with long content.

scroll-snap-stop: always prevents the user from scrolling past a snap point in a single gesture, useful for step-by-step presentations where every section must be viewed.

CSS Scroll Snap vs fullPage.js

CSS scroll snap handles the basic snapping behavior. fullPage.js builds on top of that with keyboard navigation, mobile swipe gestures, animated transitions between sections, anchor links, and more.

Feature CSS scroll-snap fullPage.js
Section transition effectsNo80+ CSS & WebGL effects
Scrolling speed controlNoYes
Infinite scroll / loopingNoYes
Snap delayNoYes
Keyboard navigation (↑↓ arrows)NoYes
Callbacks (afterLoad, onLeave)NoYes
Anchor links (#section2)NoYes
Browser history (back/forward)NoYes
Navigation dots / menuNoBuilt-in
Responsive / disable at mobileNoYes
Touch / swipe supportNative onlyOptimized + configurable
Horizontal slides within sectionsLimitedYes
Basic scroll snappingYesYes

For simple snap-to-section layouts, CSS is sufficient. For interactive presentations, marketing pages, or sites that need section transitions and full navigation control, fullPage.js saves significant development time.

Browser Support

CSS scroll snap is fully supported in all modern browsers (97.5% global coverage). fullPage.js goes further, compiled with Babel targeting IE 11, it works on virtually any browser your visitors might use.

BrowserCSS scroll-snapfullPage.js
Chrome69+26+
Firefox68+21+
Safari11+6.1+
Edge79+All versions
Mobile Safari11+7+
Chrome Android69+26+
Internet ExplorerPartial (IE 10–11, -ms- prefix only)11+

FAQ

What is CSS scroll snap?
CSS scroll snap is a set of CSS properties that lock the viewport to specific positions after scrolling. Set scroll-snap-type on the container and scroll-snap-align on each snap target. After a scroll gesture ends, the browser snaps to the nearest valid snap point.
What is the difference between mandatory and proximity snap?
mandatory always snaps after any scroll, even tiny ones; you can never rest between sections. proximity only snaps when the scroll position ends near a snap point. Use mandatory for fullscreen presentations, proximity for content-heavy pages.
How do I make a fullpage scroll in CSS?
Set the container: height: 100vh; overflow-y: scroll; scroll-snap-type: y mandatory; and each section: height: 100vh; scroll-snap-align: start;. This creates a basic fullscreen scroll. For keyboard navigation, anchor links, and animated transitions, use fullPage.js.
Does CSS scroll snap work on mobile?
Yes. CSS scroll snap works natively on mobile (97.5% support), and touch scrolling triggers the snap behavior automatically. It is supported in mobile Safari (iOS 11+), Chrome for Android (69+), and all modern mobile browsers.

Make Your Website Stand Out with Fullscreen Effects

Add scroll transitions, parallax and animations to your site with fullPage.js. One component, 80+ effects.

Brandire
New World of Work
OW Consulting

Powering fullscreen design for Google, Sony, BBC, eBay & more

Get fullPage.js
+ Suggest Effect