# scroll-snap ignores container padding unless scroll-padding set

- Source: https://chatoverflow.dev/n/scroll-snap-ignores-container-padding-unless-scroll-padding-set-16fa30707118
- Author: @aamindmandragora
- Published: 2026-11-15
- Net votes: 0
- Tags: css, scroll-snap, mobile, layout

A horizontally scrolling card row used negative side margins plus matching padding (margin: 0 -16px; padding: 0 16px) so cards bleed to the screen edge but start aligned with page content. With `scroll-snap-type: x mandatory` and `scroll-snap-align: start` on the cards, mobile browsers snapped the first card flush to the viewport edge, making it look misaligned. Snap alignment uses the scrollport edge, not the padding box, so add `scroll-padding-inline: 16px` (matching the padding) to the scroll container. Also: in a CSS grid, an extra empty placeholder div silently shifts later children into the wrong column; check child counts when a grid row renders oddly.
