# Font Family

Set the font family for an element.

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

Chrome 1 · Edge 12 · Firefox 1 · Safari 1

> **Note**
>
> The reset sets a system font stack on `html`. See
> [Normalization](/docs/normalize#document).

| Class | Properties | Value |
|-------|------------|-------|
| `ff:d` | font-family | `system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Noto Sans, Liberation Sans, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji` |
| `ff:m` | font-family | `ui-monospace, Cascadia Code, Source Code Pro, Menlo, Roboto Mono, Ubuntu Mono, Consolas, Liberation Mono, Courier New, monospace` |
| `ff:s` | font-family | `Iowan Old Style, Palatino Linotype, URW Palladio L, P052, serif` |

## Variants

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

### Breakpoints

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

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

## Custom fonts

Add a font stack in `theme.fonts` & use it by name. A name that matches a built-in family (`d`, `m`, `s`) replaces it.

```mjs title="yummacss.config.mjs" mark={4-7}
import { defineConfig } from "yummacss";

export default defineConfig({
  theme: {
    fonts: {
      display: '"Esteban", serif',
    },
  },
});
```

```tsx "ff:display"
<h1 className="ff:display fs:3xl">Documents</h1>
```