Skip to main content

Scroll Snap Align

Set the snap alignment of an element.

View as Markdown
baselinewidely
ClassCSS
ssa:cscroll-snap-align: center;
ssa:escroll-snap-align: end;
ssa:nonescroll-snap-align: none;
ssa:sscroll-snap-align: start;

Variants

Prefix any class with a variant to apply it only under that condition. Variants stack, as in @md:h:ssa:none.

Breakpoints

Apply a class from a viewport width up. Each breakpoint covers its width & every width above it.

@xs:ssa:noneFrom 32rem up.
@sm:ssa:noneFrom 40rem up.
@md:ssa:noneFrom 48rem up.
@lg:ssa:noneFrom 64rem up.
@xl:ssa:noneFrom 80rem up.
@xxl:ssa:noneFrom 96rem up.

Containers

Apply a class from a container's width up, not the viewport's. Mark the parent with ct:is first.

@c:xs:ssa:noneContainer from 32rem up.
@c:sm:ssa:noneContainer from 40rem up.
@c:md:ssa:noneContainer from 48rem up.
@c:lg:ssa:noneContainer from 64rem up.
@c:xl:ssa:noneContainer from 80rem up.
@c:xxl:ssa:noneContainer from 96rem up.

Media

Apply a class when the device or the page matches a condition, or on the first frame an element renders.

@pc:ssa:noneOn a touch screen.
@prm:ssa:noneWith reduced motion on.
@st:ssa:noneOn the first frame.

States

Apply a class only while the element is in a state, such as hovered, focused or checked.

h:ssa:noneOn :hover.
f:ssa:noneOn :focus.
fv:ssa:noneOn :focus-visible.
a:ssa:noneOn :active.
d:ssa:noneOn :disabled.
fc:ssa:noneOn :first-child.
c:ssa:noneOn :checked.
e:ssa:noneOn :empty.
fw:ssa:noneOn :focus-within.
i:ssa:noneOn :invalid.
in:ssa:noneOn :indeterminate.
lc:ssa:noneOn :last-child.
nc:ssa:noneOn :nth-child.
r:ssa:noneOn :required.
ro:ssa:noneOn :read-only.
v:ssa:noneOn :valid.

Pseudo Elements

Style a part of the element rather than the element itself, such as its placeholder or the selected text.

a::ssa:noneOn ::after.
b::ssa:noneOn ::before.
p::ssa:noneOn ::placeholder.
s::ssa:noneOn ::selection.