# content-visibility

> The `content-visibility` CSS property controls whether an element renders its contents, allowing the browser to skip rendering of off-screen content.

## How does content-visibility: auto improve page performance?

The property that allows the browser to skip layout and painting of an element's contents until they are needed. The 'auto' value defers rendering of off-screen sections, which significantly speeds up long pages.

- Topic: Visibility
- Type: property
- Browser support: Chrome 85+, Chrome Android 85+, Edge 85+, Firefox 125+, Firefox Android 125+, Safari 18+, Safari iOS 18+

## Example

Wrong:

```css
.section {
  content-visibility: auto;
}
```

Right:

```css
.section {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}
```

`contain-intrinsic-size` gives skipped sections an estimated height, so the scrollbar stays stable.

## Common mistakes

- The page jumps while scrolling because no `contain-intrinsic-size` was set.
- Putting 'auto' on above-the-fold content, which gains nothing.

## Key points

- Elements with 'auto' also have `contain-intrinsic-size`, like `auto 500px`, so the scrollbar doesn't jump.
- 'auto' is used for long off-screen sections, not for content visible on first load.
- 'hidden' is used only for content users shouldn't see, since it is removed from find-in-page and the accessibility tree.

## Interview questions

### Can users find text inside content-visibility: auto sections?

Yes. With 'auto' the content stays in the DOM, find-in-page and the accessibility tree.

### What is the difference between content-visibility: hidden and display: none?

Both hide content, but 'hidden' keeps the rendering state, so showing it again is faster.

### What does auto in contain-intrinsic-size mean?

The browser remembers the last rendered size and uses it instead of the estimate once the section has been shown.

## Related cards

- [Rendering Order](https://wonderium.dev/web/rendering-order.md)
- [INP](https://wonderium.dev/web/inp.md)
- [Reflow](https://wonderium.dev/web/reflow.md)
- [display](https://wonderium.dev/css/display.md)
- [visibility](https://wonderium.dev/css/visibility.md)

---

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