Skip to main content

Aspect Ratio

Set the aspect ratio of an element.

View as Markdown
baselinewidely

Variants

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

Breakpoints

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

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

States

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

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

Pseudo Elements

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

a::ar:4/5On ::after.
b::ar:4/5On ::before.
p::ar:4/5On ::placeholder.
s::ar:4/5On ::selection.