# Grid Auto Flow

Set how items are automatically placed in a grid.

**Widely available.** This feature is well established and works across many devices and browser versions.

Chrome 57 · Edge 16 · Firefox 52 · Safari 10.1

| Class | Properties | Value |
|-------|------------|-------|
| `gaf:c` | grid-auto-flow | `column` |
| `gaf:cd` | grid-auto-flow | `column dense` |
| `gaf:d` | grid-auto-flow | `dense` |
| `gaf:r` | grid-auto-flow | `row` |
| `gaf:rd` | grid-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.

| Class | Applies |
|-------|---------|
| `@xs:gaf:d` | From 32rem up. |
| `@sm:gaf:d` | From 40rem up. |
| `@md:gaf:d` | From 48rem up. |
| `@lg:gaf:d` | From 64rem up. |
| `@xl:gaf:d` | From 80rem up. |
| `@xxl:gaf:d` | From 96rem up. |

### Containers

Apply a class from a container's width up, not the viewport's. Mark the parent with `ct:is` first.

| Class | Applies |
|-------|---------|
| `@c:xs:gaf:d` | Container from 32rem up. |
| `@c:sm:gaf:d` | Container from 40rem up. |
| `@c:md:gaf:d` | Container from 48rem up. |
| `@c:lg:gaf:d` | Container from 64rem up. |
| `@c:xl:gaf:d` | Container from 80rem up. |
| `@c:xxl:gaf:d` | Container from 96rem up. |

### Media

Apply a class when the device or the page matches a condition, or on the first frame an element renders.

| Class | Applies |
|-------|---------|
| `@pc:gaf:d` | On a touch screen. |
| `@prm:gaf:d` | With reduced motion on. |
| `@st:gaf:d` | On the first frame. |

### States

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

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

### Pseudo Elements

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

| Class | Applies |
|-------|---------|
| `a::gaf:d` | On ::after. |
| `b::gaf:d` | On ::before. |
| `p::gaf:d` | On ::placeholder. |
| `s::gaf:d` | On ::selection. |