Skip to main content

Margin

Set the margin for an element.

View as Markdown
baselinewidely

The same values work with my, mbe, mbs, mb, mx, mie, mis, ml, mr & mt, as in mt:4.

Variants

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

Breakpoints

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

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

States

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

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

Pseudo Elements

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

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

Negative

Put a minus after the colon to negate a value.

m:-4A minus after the colon.