CSS scroll-snap-align Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Scroll Snap

What You’ll Learn

The scroll-snap-align property controls how snap targets align inside a scroll container when scrolling stops. It helps create predictable carousel, gallery, and panel snapping.

01

align

Snap position.

02

start

Leading edge.

03

center

Middle stop.

04

target

On child.

05

carousel

Slide snap.

06

type

With container.

Introduction

The scroll-snap-align property in CSS is part of the CSS Scroll Snap Module. It specifies how a snap point aligns with the scroll container’s scrollport when scrolling ends.

By using this property, you can control whether each slide, card, or panel snaps to the start edge, center, or end edge of the visible scroll area.

Definition and Usage

Apply scroll-snap-align to snap targets inside a scroll container — such as carousel slides inside a wrapper that already has scroll-snap-type enabled.

It works together with scroll-snap-type on the container and optional scroll-padding inset on the scrollport.

💡
Beginner Tip

Put scroll-snap-type: x mandatory; on the container and scroll-snap-align: start; on each slide. When scrolling stops, each slide lines up with the start of the scrollport.

📝 Syntax

The syntax for the scroll-snap-align property is straightforward. It is applied to snap targets inside a scroll container.

syntax.css
element {
  scroll-snap-align: none | start | center | end;
}

Basic Example

snap-target.css
.scroll-item {
  scroll-snap-align: start;
}

Related Properties

  • scroll-snap-type — enables snapping on the scroll container
  • scroll-snap-stop — controls whether scrolling can skip snap positions
  • scroll-padding — insets the scrollport on the container

🎯 Default Value

The default value of the scroll-snap-align property is none, which means no snapping alignment is applied to the element.

⚡ Quick Reference

QuestionAnswer
Default valuenone
Common valuesstart, center, end
Works withscroll-snap-type on the container
Accepted valuesnone, start, center, end
Set onSnap targets inside scroll containers
InheritedNo
AnimatableNo

💎 Property Values

ValueExampleDescription
nonescroll-snap-align: none;No snapping alignment is applied.
startscroll-snap-align: start;The element aligns with the start edge of the scroll container.
centerscroll-snap-align: center;The element aligns with the center of the scroll container.
endscroll-snap-align: end;The element aligns with the end edge of the scroll container.
start center end

When to Use scroll-snap-align

scroll-snap-align helps when snap targets need predictable landing positions:

  • Horizontal carousels — Snap each slide to the start, center, or end of the viewport.
  • Image galleries — Keep each photo aligned consistently when the user stops scrolling.
  • Vertical panel flows — Snap full-height sections in onboarding or story layouts.
  • Pagination-style scrollers — Make each card feel like a deliberate page stop.

Enable snapping on the container with scroll-snap-type first, then choose alignment on each snap target.

👀 Live Preview

Scroll sideways inside the box. Each panel uses scroll-snap-align: start.

Slide 1
Slide 2

When scrolling stops, each snap target aligns with the start edge of the scrollport.

Examples Gallery

Start with the reference horizontal carousel, compare center and end alignment, then try a vertical snap layout.

📜 Snap Target Alignment

Align snap targets inside a scroll container — matching the reference example.

Example 1 — Horizontal scroll snap with start alignment

In this example, we’ll create a horizontal scrolling container where each item snaps to the start when scrolling ends.

index.html
<style>
  .scroll-container {
    display: flex;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
  }

  .scroll-item {
    scroll-snap-align: start;
    flex: 0 0 auto;
    width: 200px;
    height: 200px;
    margin-right: 10px;
    background-color: lightblue;
  }
</style>

<div class="scroll-container">
  <div class="scroll-item">1</div>
  <div class="scroll-item">2</div>
  <div class="scroll-item">3</div>
</div>
Try It Yourself

How It Works

The container enables snapping with scroll-snap-type, and each child becomes a snap target with scroll-snap-align: start.

Example 2 — Center-aligned carousel slides

Use scroll-snap-align: center when each slide should land in the middle of the viewport.

center-snap.css
.carousel-slide {
  scroll-snap-align: center;
}
Try It Yourself

How It Works

Center alignment is useful for hero carousels and card pickers where the focused item should sit in the middle.

📄 Other Alignment Modes

Try end alignment and vertical snap panels for different layout patterns.

Example 3 — End-aligned snap cards

Set scroll-snap-align: end when each card should align with the trailing edge of the scrollport.

end-snap.css
.card {
  scroll-snap-align: end;
}
Try It Yourself

How It Works

End alignment can help when the trailing edge of each item should feel like the natural stopping point.

Example 4 — Vertical panels with start alignment

Use scroll-snap-align: start on full-height panels inside a vertical snap scroller.

vertical-snap.css
.scroll-container {
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
}

.snap-item {
  scroll-snap-align: start;
}
Try It Yourself

How It Works

The same alignment values work vertically when the container uses scroll-snap-type: y mandatory.

scroll-snap-align in the family

scroll-snap-align works on snap targets inside a container that already has scroll-snap-type. Pair it with scroll-padding when fixed UI overlaps the scrollport.

container-and-target.css
.scroll-container { scroll-snap-type: x mandatory; }
.scroll-item { scroll-snap-align: start; }

🧠 How scroll-snap-align Works

1

Container enables snapping

The scroll container uses scroll-snap-type to turn on snapping along an axis.

Container
2

Targets choose alignment

Each snap target gets scroll-snap-align with start, center, or end.

Target
3

Scroll motion finishes

When scrolling stops, the browser snaps the nearest target into the chosen alignment position.

Snap
=

Predictable snap stops

Carousels and panel scrollers feel intentional instead of stopping halfway between items.

Browser Compatibility

The scroll-snap-align property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.

Scroll snap · Modern support

Reliable snap-align support

Current Chrome, Firefox, Safari, Edge, and Opera support scroll-snap-align on snap targets.

97% Modern browser support
Google Chrome 69+ · Desktop & Mobile
Full support
Mozilla Firefox 68+ · Desktop & Mobile
Full support
Apple Safari 14.1+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 56+ · Modern versions
Full support

Testing tip

Test horizontal and vertical snap carousels on mobile browsers to confirm start, center, and end alignment feel natural.

scroll-snap-align property 97% supported

Bottom line: scroll-snap-align is safe to use in modern projects for snap targets inside scroll containers.

Conclusion

The scroll-snap-align property is a powerful tool for creating smooth and user-friendly scrolling experiences. By controlling the alignment of snap points, you can enhance navigation in carousels and panel scrollers.

Experiment with start, center, and end to see how each value changes the feel of your layout. Pair it with scroll-snap-type on the container for the full scroll snap effect.

💡 Best Practices

✅ Do

  • Apply scroll-snap-align on snap targets, not the scroll container
  • Enable scroll-snap-type on the container first
  • Use start for paginated carousels and card rows
  • Use center for hero sliders and featured picks
  • Test snap behavior on touch devices

❌ Don’t

  • Expect snapping without scroll-snap-type on the container
  • Mix conflicting alignments unless the layout needs it
  • Forget scroll-padding when fixed headers overlap snapped content
  • Assume none will snap — it disables alignment on that target

Key Takeaways

Knowledge Unlocked

Five things to remember about scroll-snap-align

Use these points when aligning snap targets inside scroll containers.

5
Core concepts
02

start / center / end

Three align modes.

Values
03

snap target

Set on children.

Scope
04

scroll-snap-type

Container first.

Pairing
05

carousels

Common use case.

Use case
🔄 06

scroll-padding

Offset scrollport.

Companion

❓ Frequently Asked Questions

scroll-snap-align sets how a snap target aligns within its scroll container when scrolling stops. It controls whether the element snaps to the start, center, or end of the scrollport.
scroll-snap-type is set on the scroll container and enables snapping along an axis. scroll-snap-align is set on snap targets inside the container and chooses their alignment position.
The default value is none, meaning the element does not participate as a snap target unless you set start, center, or end.
Apply it to the elements that should snap, such as carousel slides, gallery cards, or vertical panels inside a container that already has scroll-snap-type enabled.
Use it when you want predictable snap positions in carousels, image galleries, onboarding screens, or any scroll container where each item should land at a consistent edge or center point.

Practice in the Live Editor

Open the HTML editor and try scroll-snap-align: start on carousel slides inside a snap container.

HTML Editor →

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