Skip to main content

Color Scheme

Set which color schemes an element can be rendered in.

View as Markdown
baselinewidely
ClassCSS
cs:dcolor-scheme: dark;
cs:lcolor-scheme: light;
cs:ldcolor-scheme: light dark;

Variants

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

Breakpoints

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

@xs:cs:lFrom 32rem up.
@sm:cs:lFrom 40rem up.
@md:cs:lFrom 48rem up.
@lg:cs:lFrom 64rem up.
@xl:cs:lFrom 80rem up.
@xxl:cs:lFrom 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:cs:lContainer from 32rem up.
@c:sm:cs:lContainer from 40rem up.
@c:md:cs:lContainer from 48rem up.
@c:lg:cs:lContainer from 64rem up.
@c:xl:cs:lContainer from 80rem up.
@c:xxl:cs:lContainer 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:cs:lOn a touch screen.
@prm:cs:lWith reduced motion on.
@st:cs:lOn the first frame.

States

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

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

Pseudo Elements

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

a::cs:lOn ::after.
b::cs:lOn ::before.
p::cs:lOn ::placeholder.
s::cs:lOn ::selection.