Skip to main content

Grid Auto Flow

Set how items are automatically placed in a grid.

View as Markdown
baselinewidely
ClassCSS
gaf:cgrid-auto-flow: column;
gaf:cdgrid-auto-flow: column dense;
gaf:dgrid-auto-flow: dense;
gaf:rgrid-auto-flow: row;
gaf:rdgrid-auto-flow: row dense;

Variants

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

Breakpoints

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

@xs:gaf:dFrom 32rem up.
@sm:gaf:dFrom 40rem up.
@md:gaf:dFrom 48rem up.
@lg:gaf:dFrom 64rem up.
@xl:gaf:dFrom 80rem up.
@xxl:gaf:dFrom 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:gaf:dContainer from 32rem up.
@c:sm:gaf:dContainer from 40rem up.
@c:md:gaf:dContainer from 48rem up.
@c:lg:gaf:dContainer from 64rem up.
@c:xl:gaf:dContainer from 80rem up.
@c:xxl:gaf:dContainer 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:gaf:dOn a touch screen.
@prm:gaf:dWith reduced motion on.
@st:gaf:dOn the first frame.

States

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

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

Pseudo Elements

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

a::gaf:dOn ::after.
b::gaf:dOn ::before.
p::gaf:dOn ::placeholder.
s::gaf:dOn ::selection.