Skip to main content

Scroll Snap Type

Set the scroll snap direction & strictness.

View as Markdown
baselinewidely
ClassCSS
sst:bmscroll-snap-type: both mandatory;
sst:nonescroll-snap-type: none;
sst:xmscroll-snap-type: x mandatory;
sst:xpscroll-snap-type: x proximity;
sst:ymscroll-snap-type: y mandatory;
sst:ypscroll-snap-type: y proximity;

Variants

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

Breakpoints

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

@xs:sst:xpFrom 32rem up.
@sm:sst:xpFrom 40rem up.
@md:sst:xpFrom 48rem up.
@lg:sst:xpFrom 64rem up.
@xl:sst:xpFrom 80rem up.
@xxl:sst:xpFrom 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:sst:xpContainer from 32rem up.
@c:sm:sst:xpContainer from 40rem up.
@c:md:sst:xpContainer from 48rem up.
@c:lg:sst:xpContainer from 64rem up.
@c:xl:sst:xpContainer from 80rem up.
@c:xxl:sst:xpContainer 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:sst:xpOn a touch screen.
@prm:sst:xpWith reduced motion on.
@st:sst:xpOn the first frame.

States

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

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

Pseudo Elements

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

a::sst:xpOn ::after.
b::sst:xpOn ::before.
p::sst:xpOn ::placeholder.
s::sst:xpOn ::selection.