CSS scroll-snap-align Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The scroll-snap-align property sets how a box’s snap area aligns inside the scroll container’s snapport. It is set on snap targets (slides, panels, cards) — not on the scroller itself.

Common values are start, center, and end. The initial value is none (not a snap target). It is not inherited. The container still needs scroll-snap-type.

Baseline Widely available.

Standard-track scroll snap longhand. One keyword applies to both axes; two keywords set block then inline.

CSS Syntax

syntax.css
scroll-snap-align: none | start | end | center | [block inline] | initial | inherit;

With two values, the first is the block axis and the second is the inline axis.

Property Values

ValueDescriptionTry it
noneDefault. Element is not a snap targetTry it
startSnap the start edge into the snapportTry it
centerSnap the center into the snapportTry it
endSnap the end edge into the snapportTry it
initialResets to noneTry it
inheritTakes the parent’s scroll-snap-alignTry it

How to Use scroll-snap-align

Enable snap on the container, then align each target.

  1. Make a scroll container with overflow and scroll-snap-type (for example x mandatory).
  2. Mark each slide or panel with scroll-snap-align.
  3. Pick start, center, or end for the look you want.
  4. Optionally add scroll-padding or scroll-margin for breathing room.
PieceRequired?Role
Scroll containerYesoverflow + scroll-snap-type
scroll-snap-alignYesSet on each snap target
Axis matchYesUse x or y snap type that matches your layout
Padding / marginOptionalInset the snapport or grow the snap area

Live Preview

Scroll the strip sideways. Change scroll-snap-align on the panels and snap again.

The scroller uses scroll-snap-type: x mandatory. Only panel alignment changes.

Scroll →
1
2
3

scroll-snap-align: start

CSS Examples

Each snippet focuses on scroll-snap-align. Use Try It Yourself for a live editor.

Example 1 — Snap to Start

Each panel’s start edge lines up with the start of the snapport.

CSS
<style>
  .scroller {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .panel {
    scroll-snap-align: start;
  }
</style>

<div class="scroller">
  <div class="panel">1</div>
  <div class="panel">2</div>
  <div class="panel">3</div>
</div>
Try It Yourself

How It Works

  1. Enable horizontal snap. scroll-snap-type: x mandatory forces snap stops.
  2. Align to start. Each panel uses scroll-snap-align: start.
  3. Edge meets edge. The panel’s start side meets the snapport’s start side.
  4. Common for carousels. Full-width slides usually snap to start.

Example 2 — Snap to Center

Each panel centers itself in the scrollport when scrolling stops.

CSS
<style>
  .scroller {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .panel {
    scroll-snap-align: center;
  }
</style>

<div class="scroller">
  <div class="panel">1</div>
  <div class="panel">2</div>
  <div class="panel">3</div>
</div>
Try It Yourself

How It Works

  1. Same container setup. Snapping is still mandatory on the x axis.
  2. Center each target. scroll-snap-align: center aims at the middle.
  3. Peek neighbors. Side panels often show beside the active one.
  4. Good for cards. Useful when slides are narrower than the scroller.

Example 3 — Snap to End

Each panel’s end edge lines up with the end of the snapport.

CSS
<style>
  .scroller {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .panel {
    scroll-snap-align: end;
  }
</style>

<div class="scroller">
  <div class="panel">1</div>
  <div class="panel">2</div>
  <div class="panel">3</div>
</div>
Try It Yourself

How It Works

  1. Snap on the end edge. end uses the trailing side of each panel.
  2. Matches end padding. Pair with scroll-padding on the end side when needed.
  3. Opposite of start. Useful for RTL-like layouts or trailing chrome.
  4. Still needs type. Without scroll-snap-type, align alone does nothing visible.

Edge Cases & Pitfalls

If nothing snaps, check the container first — then the align value.

type

Needs scroll-snap-type on the container

Align alone does not enable snapping. Set scroll-snap-type on the overflow scroller.

none

none skips that element

Use none when a child should scroll freely and never become a snap stop.

axes

Two values mean block then inline

start center sets block-start and inline-center. One value applies to both axes.

vs

Padding and margin are different

scroll-padding insets the container snapport. scroll-margin expands the target snap area. Align chooses which edge snaps.

stop

Force stopping with scroll-snap-stop

scroll-snap-stop: always can prevent skipping past a target during a fling.

Browser Support

scroll-snap-align is a browser layout property for scroll snap. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available since 2020

scroll-snap-align

Chrome 69+, Firefox 68+, Safari 11+, Edge 79+, Opera 56+, Samsung Internet 10.1+. Internet Explorer does not support the modern property.

97% Modern browsers
Google Chrome 69+
Full support
Mozilla Firefox 68+
Full support
Apple Safari 11+
Full support
Microsoft Edge 79+
Full support
Opera 56+
Full support
Samsung Internet 10.1+
Full support
Internet Explorer No support
Not supported
scroll-snap-align Widely supported

Bottom line: Safe for modern carousels and snap UIs. Pair with scroll-snap-type on the container. Not a server runtime API.

Key Takeaways

  • Role: choose how each snap target aligns inside the snapport.
  • Values: none, start, center, end (one or two keywords).
  • Initial value: none. Not inherited. Set on targets, not the scroller.
  • Tip: always pair with scroll-snap-type on the overflow container.

One line: scroll-snap-align tells each slide whether to snap to the start, center, or end of the scrollport.

Frequently Asked Questions

It sets how a snap target aligns inside the scroll container’s snapport. Common values are start, center, and end.
The initial value is none. The element is not a snap target until you set start, center, or end.
scroll-snap-type is set on the scroll container and turns snapping on. scroll-snap-align is set on each target and chooses where that target snaps.
Yes. One value applies to both axes. Two values set block then inline: for example start center.
No. Set it on each element that should snap.
It is Baseline and widely available: Chrome 69+, Firefox 68+, Safari 11+, Edge 79+, Opera 56+. Internet Explorer does not support the modern property. It is a browser layout property, not a Node.js feature.

Next: scroll-snap-stop

Learn how to force the scroll to stop at each snap target.

scroll-snap-stop tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful