# scroll-snap-align

> The `scroll-snap-align` CSS property specifies the snap position of an element inside a scroll container.

## How do I make items snap into place when scrolling?

The property of a child element that defines which part of it aligns with the scroll container when snapping. Takes 'start', 'center' or 'end' values and works together with `scroll-snap-type`.

- Topic: Client Interface
- Type: property
- Browser support: Chrome 69+, Chrome Android 69+, Edge 79+, Firefox 68+, Firefox Android 68+, Safari 11+, Safari iOS 11+

## Example

Wrong:

```css
.gallery {
  scroll-snap-align: center;
}
```

Right:

```css
.gallery {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.gallery img {
  scroll-snap-align: center;
}
```

`scroll-snap-align` belongs on the items, while the container gets `overflow` and `scroll-snap-type`.

## Common mistakes

- Putting `scroll-snap-align` on the container instead of the items.

## Key points

- `scroll-snap-align` is set on the items, while `scroll-snap-type` is set on the container.
- `scroll-padding` on the container accounts for sticky headers.

## Interview questions

### What values does scroll-snap-align accept?

'none', 'start', 'end' and 'center'. Two values set the block axis first, then the inline axis.

### Can items snap to a position offset from the edge?

Yes. Use `scroll-padding` on the container or `scroll-margin` on the item to move the snap position.

### Why do my items not snap?

Usually the container lacks `scroll-snap-type` or a scrolling `overflow`, or the items lack `scroll-snap-align`.

## Related cards

- [scroll-snap-type](https://wonderium.dev/css/scroll-snap-type.md)
- [scroll-padding](https://wonderium.dev/css/scroll-padding.md)
- [overflow](https://wonderium.dev/css/overflow.md)
- [scroll-behavior](https://wonderium.dev/css/scroll-behavior.md)
- [.scrollIntoView()](https://wonderium.dev/js/scroll-into-view.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/scroll-snap-align
- Last updated: 2026-11-25
