# font

> The `font` CSS property is a shorthand for setting multiple font properties in one declaration.

## What is the order of values in the CSS font shorthand?

The shorthand property that sets several font-related properties in one declaration, including `font-style`, `font-variant`, `font-weight`, `font-size`, `line-height` and `font-family`. Values that are not specified are reset to their initial values.

- Topic: Text Handling
- Type: property
- Browser support: Chrome 1+, Chrome Android 18+, Edge 12+, Firefox 1+, Firefox Android 4+, Safari 1+, Safari iOS 1+

## Example

Wrong:

```css
.title {
  line-height: 1.2;
  font: 700 2rem;
}
```

Right:

```css
.title {
  font: 700 2rem/1.2 system-ui, sans-serif;
}
```

Size and family are required, and putting line height after the slash avoids the shorthand resetting it.

## Common mistakes

- The `font` shorthand is ignored because the family or size is missing.
- A later `font` shorthand resets `line-height` and `font-weight` set earlier.

## Key points

- The shorthand includes both `font-size` and `font-family`, the two required values.
- Values follow the order style, weight, then size with optional `/line-height`, then family.
- Form controls get `font: inherit` so they match the page font.

## Interview questions

### Why do form inputs not use my page font?

Inputs and buttons don't inherit font by default. Add `button, input, select, textarea { font: inherit; }`.

### Does the font shorthand reset other properties?

Yes. Any sub-property you leave out, such as `line-height`, is reset to its initial value.

## Related cards

- [font-family](https://wonderium.dev/css/font-family.md)
- [font-size](https://wonderium.dev/css/font-size.md)
- [line-height](https://wonderium.dev/css/line-height.md)
- [font-weight](https://wonderium.dev/css/font-weight.md)
- [font-style](https://wonderium.dev/css/font-style.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/font
- Last updated: 2026-11-25
