Skip to main content

Will Change

Hint which properties of an element are about to animate.

View as Markdown
baselinewidely
ClassCSS
wc:autowill-change: auto;
wc:cwill-change: contents;
wc:owill-change: opacity;
wc:swill-change: scale;
wc:spwill-change: scroll-position;
wc:twill-change: transform;
wc:trwill-change: translate;

Variants

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

Breakpoints

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

@xs:wc:sFrom 32rem up.
@sm:wc:sFrom 40rem up.
@md:wc:sFrom 48rem up.
@lg:wc:sFrom 64rem up.
@xl:wc:sFrom 80rem up.
@xxl:wc:sFrom 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:wc:sContainer from 32rem up.
@c:sm:wc:sContainer from 40rem up.
@c:md:wc:sContainer from 48rem up.
@c:lg:wc:sContainer from 64rem up.
@c:xl:wc:sContainer from 80rem up.
@c:xxl:wc:sContainer 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:wc:sOn a touch screen.
@prm:wc:sWith reduced motion on.
@st:wc:sOn the first frame.

States

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

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

Pseudo Elements

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

a::wc:sOn ::after.
b::wc:sOn ::before.
p::wc:sOn ::placeholder.
s::wc:sOn ::selection.