# Scroll Snap Carousel

> A swipeable horizontal carousel that snaps each slide into place. No JavaScript.

- Category: [CSS Layouts](https://copy-css.com/category/layouts)
- Tags: carousel, slider, scroll-snap, horizontal, swipe
- Live preview: https://copy-css.com/snippets/scroll-snap-carousel
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="snap-row">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
</div>
```

## CSS

```css
.snap-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 80%;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 8px;
  padding: 0 8px 8px;
}

.snap-row > * {
  scroll-snap-align: start;
}
```

## Notes

- This CSS Scroll Snap Carousel is 15 lines of pure CSS (0.3 KB) with no JavaScript and no dependencies. It uses CSS Grid and scroll snapping.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
