# Object Fit

Set how to resize the content of a replaced element.

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

Chrome 32 · Edge 79 · Firefox 36 · Safari 10

| Class | Properties | Value |
|-------|------------|-------|
| `of:c` | object-fit | `cover` |
| `of:f` | object-fit | `fill` |
| `of:none` | object-fit | `none` |
| `of:sd` | object-fit | `scale-down` |

## Variants

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

### Breakpoints

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

| Class | Applies |
|-------|---------|
| `@xs:of:none` | From 32rem up. |
| `@sm:of:none` | From 40rem up. |
| `@md:of:none` | From 48rem up. |
| `@lg:of:none` | From 64rem up. |
| `@xl:of:none` | From 80rem up. |
| `@xxl:of:none` | 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:of:none` | Container from 32rem up. |
| `@c:sm:of:none` | Container from 40rem up. |
| `@c:md:of:none` | Container from 48rem up. |
| `@c:lg:of:none` | Container from 64rem up. |
| `@c:xl:of:none` | Container from 80rem up. |
| `@c:xxl:of:none` | 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:of:none` | On a touch screen. |
| `@prm:of:none` | With reduced motion on. |
| `@st:of:none` | 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:of:none` | On :hover. |
| `f:of:none` | On :focus. |
| `fv:of:none` | On :focus-visible. |
| `a:of:none` | On :active. |
| `d:of:none` | On :disabled. |
| `fc:of:none` | On :first-child. |
| `c:of:none` | On :checked. |
| `e:of:none` | On :empty. |
| `fw:of:none` | On :focus-within. |
| `i:of:none` | On :invalid. |
| `in:of:none` | On :indeterminate. |
| `lc:of:none` | On :last-child. |
| `nc:of:none` | On :nth-child. |
| `r:of:none` | On :required. |
| `ro:of:none` | On :read-only. |
| `v:of:none` | 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::of:none` | On ::after. |
| `b::of:none` | On ::before. |
| `p::of:none` | On ::placeholder. |
| `s::of:none` | On ::selection. |