Skip to main content

Scroll Margin

Set the scroll margin for snapping & alignment.

View as Markdown
baselinewidely

The same values work with smb, smie, smis, sml, smr, smt, smx & smy, as in smy:4.

Variants

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

Breakpoints

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

@xs:sm:4From 32rem up.
@sm:sm:4From 40rem up.
@md:sm:4From 48rem up.
@lg:sm:4From 64rem up.
@xl:sm:4From 80rem up.
@xxl:sm:4From 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:sm:4Container from 32rem up.
@c:sm:sm:4Container from 40rem up.
@c:md:sm:4Container from 48rem up.
@c:lg:sm:4Container from 64rem up.
@c:xl:sm:4Container from 80rem up.
@c:xxl:sm:4Container 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:sm:4On a touch screen.
@prm:sm:4With reduced motion on.
@st:sm:4On the first frame.

States

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

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

Pseudo Elements

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

a::sm:4On ::after.
b::sm:4On ::before.
p::sm:4On ::placeholder.
s::sm:4On ::selection.

Negative

Put a minus after the colon to negate a value.

sm:-4A minus after the colon.