# text-indent

> The `text-indent` CSS property specifies the amount of space to indent the first line of a block of text.

## How do I indent the first line of a paragraph in CSS?

The property that specifies the amount of space that is added before the start of the first line of text in a block. It's commonly used to indent the first line of a paragraph, making text easier to read or helping to visually separate content.

- 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
.intro span {
  text-indent: 2em;
}
```

Right:

```css
.intro {
  text-indent: 2em;
}
```

`text-indent` only applies to block containers, so it belongs on the paragraph, not on an inline element inside it.

## Common mistakes

- Putting `text-indent` on a `span` and seeing no change.
- Using a large negative indent to hide text, which breaks in right-to-left layouts.

## Key points

- `text-indent` is set on a block container such as `p`, not on an inline `span`.
- Indents use `em` so they scale with the font size.
- Hiding text uses a visually hidden class, not `text-indent: -9999px`.

## Interview questions

### How do I make a hanging indent in CSS?

Use a negative `text-indent` with the same positive `padding-inline-start`, so the first line starts left of the rest.

### Does text-indent apply to every line?

No. By default it indents only the first line of the block, and lines after a forced break are not indented.

### Why does text-indent not work on my span?

Inline elements are not block containers. Set the property on the parent block or make the element `display: block` or 'inline-block'.

## Related cards

- [padding](https://wonderium.dev/css/padding.md)
- [text-align](https://wonderium.dev/css/text-align.md)
- [::first-line](https://wonderium.dev/css/first-line.md)
- [Logical Properties](https://wonderium.dev/css/logical-properties.md)
- [sr-only](https://wonderium.dev/a11y/sr-only.md)

---

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