Skip to main content

Container Type

Make an element a container its children can query.

View as Markdown
baselinewidely
ClassCSS
ct:iscontainer-type: inline-size;
ct:ncontainer-type: normal;
ct:scontainer-type: size;

Variants

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

Breakpoints

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

@xs:ct:nFrom 32rem up.
@sm:ct:nFrom 40rem up.
@md:ct:nFrom 48rem up.
@lg:ct:nFrom 64rem up.
@xl:ct:nFrom 80rem up.
@xxl:ct:nFrom 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:ct:nContainer from 32rem up.
@c:sm:ct:nContainer from 40rem up.
@c:md:ct:nContainer from 48rem up.
@c:lg:ct:nContainer from 64rem up.
@c:xl:ct:nContainer from 80rem up.
@c:xxl:ct:nContainer 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:ct:nOn a touch screen.
@prm:ct:nWith reduced motion on.
@st:ct:nOn the first frame.

States

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

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

Pseudo Elements

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

a::ct:nOn ::after.
b::ct:nOn ::before.
p::ct:nOn ::placeholder.
s::ct:nOn ::selection.