Key takeaway
- CSS content-visibility lets browsers skip off-screen rendering. Learn auto vs hidden, contain-intrinsic-size, browser support and accessibility.
What is the CSS content-visibility property?
The CSS content-visibility property lets the browser skip the layout and paint work for an element's contents until they are needed. It takes three values, visible, hidden and auto, and the most common choice for long pages is auto. Put on the sections that sit below the fold, it can cut the cost of the first render, as set out on MDN and web.dev.
It works best with its partner property, contain-intrinsic-size, which gives skipped content a placeholder size so the page does not jump. According to web.dev, it is supported in Chrome 85, Edge 85, Firefox 125 and Safari 18. This guide covers how it works, how it compares with other ways of hiding content, accessibility, and when not to use it. For the wider picture, see our guide to web performance optimisation and Core Web Vitals.
How does content-visibility make pages render faster?
Normally a browser styles and lays out every part of a page, even the parts the reader cannot see. With content-visibility: auto, the browser still styles and lays out the element box, but it skips the work inside it while the element is off-screen. The page downloads in the same way; only the rendering work changes. To see where this work sits in the pipeline, read how the browser builds the render tree.
The web.dev article uses a travel blog as its example. Applying content-visibility: auto to each story section cut the initial rendering time from 232 ms to 30 ms in that demo, which it calls a 7x boost. Treat that as one published demo on one page, not a guarantee. Measure your own pages, for example with Google Lighthouse.
.story {
content-visibility: auto;
contain-intrinsic-size: auto 500px;
}What do visible, hidden and auto do?
| Value | What the browser does | When it fits |
|---|---|---|
| visible | Default. No effect; contents are laid out and rendered normally. | Anything that should always render. |
| auto | Turns on layout, style and paint containment. Skips the contents while the element is not relevant to the user, but keeps them available to find-in-page, tab order, focus and selection. | Long pages with many below-the-fold sections, feeds and lists. |
| hidden | Skips the contents, like display: none, but keeps the rendering state. Contents are not available to find-in-page, tab order, focus or selection. | Inactive views you want to bring back quickly, such as tabs or app screens. |
Source: MDN, content-visibility.
Why do you need contain-intrinsic-size?
Skipped content has no natural size. Without a placeholder, an unsized element can collapse to zero height, so the scrollbar grows and the layout shifts as sections render. The contain-intrinsic-size property supplies the size used while the contents are skipped.
The auto keyword is the useful part. With contain-intrinsic-size: auto 500px, the browser uses 500px the first time, then remembers the real rendered size and uses that when the section scrolls out of view again. MDN warns that a placeholder far from the real size causes a visible jump when the section arrives, so pick a reasonable estimate. For grid and multi-column layouts, MDN recommends auto none over 0px, because a zero size can make contents overflow their parents. If you need older browsers, feature-detect the auto forms with @supports.
How does content-visibility: hidden compare with display: none and visibility: hidden?
| Method | Rendering state | Cost to show again | Takes space and receives clicks? |
|---|---|---|---|
| display: none | Discarded | As much as rendering new content | No, removed from layout |
| visibility: hidden | Kept | Low, but the state is refreshed when needed | Yes, still takes space and can be clicked |
| content-visibility: hidden | Kept; updates are applied when shown again | Low | Contents are skipped; the box itself stays |
Source: web.dev, content-visibility.
A good use for hidden is a single-page application. Inactive views can be set to content-visibility: hidden so they stay in the DOM with their cached state, then render quickly when the view is activated. For code that loads only on demand, see our guide to code splitting in React.
Is content-visibility accessible?
With auto, off-screen content stays in the DOM and the accessibility tree, so assistive technology and find-in-page can still reach it, according to MDN. With hidden, the skipped contents cannot be found, tabbed to, focused or selected. Note that display: none and visibility: hidden elements can still appear in the accessibility tree; add aria-hidden="true" if you need them out of it. MDN also documents a contentvisibilityautostatechange event that fires when rendering starts or stops being skipped, which you can use to pause costly work such as canvas drawing.
Which browsers support content-visibility?
| Browser | First version with support |
|---|---|
| Chrome | 85 |
| Edge | 85 |
| Firefox | 125 |
| Safari | 18 |
Source: web.dev (last updated 23 September 2025). MDN tags content-visibility Baseline Newly available and contain-intrinsic-size Baseline Widely available. Confirm the current version table on MDN before you set your support policy. A browser that does not recognise a CSS property ignores it, so the property can be added as a progressive enhancement.
What is CSS containment and how does it relate?
content-visibility builds on CSS containment, which isolates part of the page so that its contents have predictable effects on the rest. The four kinds are size, layout, paint and style containment. According to MDN, content-visibility: auto turns on layout, style and paint containment, and skipped content also gets size containment, which is why a placeholder size matters. Because containment limits how contents interact with the rest of the page, check that overflowing elements, such as tooltips or dropdowns, still display as intended.
When should you use it, and when not?
| Situation | Use it? | Why |
|---|---|---|
| Long article or documentation pages | Yes, with auto | Many below-the-fold sections that need no early rendering. |
| Product lists and feeds | Yes, with auto and a good size estimate | Large repeated blocks. Test scroll behaviour. |
| Inactive tabs or app views | Yes, with hidden | Keeps rendering state and makes re-showing cheaper. |
| Above-the-fold content | No | It must render immediately. |
| Short, light pages | Probably not | Little work to skip; extra tuning has no payoff. |
| Content that must stay findable but is hidden | No, avoid hidden | Hidden content is not available to find-in-page. |
A sensible adoption sequence
- Measure first with Lighthouse or your browser's performance tools.
- Apply content-visibility: auto to repeated below-the-fold sections only.
- Add contain-intrinsic-size: auto with a realistic length.
- Test scrolling for jumps, and test keyboard, find-in-page and screen reader behaviour.
- Measure again and keep the change only if the numbers improve.
What does this mean for enterprise teams?
Enterprise portals, dashboards and documentation hubs often render long lists of cards and tables, which is where this property pays off. Treat it as one control in a wider performance budget, alongside fluid typography with CSS clamp and font fallback tuning with size-adjust, and check it in CI so regressions are caught. Teams that put AI agents behind these interfaces can see how ElixirData Context OS keeps governed context, versioned policy and decision traces in one decision layer above AI agents, and how ElixirClaw is an agentic OS platform to build, orchestrate and govern AI agents and automation workflows while keeping humans in control.
To map one front-end performance or interface decision your agents should make, and the context and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What does CSS content-visibility do?
It tells the browser it may skip the layout and painting work for an element's contents. With auto, the browser skips the contents while the element is not relevant to the user, and renders them as the element nears the viewport, according to MDN.
Is content-visibility supported in all major browsers?
According to web.dev, it is supported from Chrome 85, Edge 85, Firefox 125 and Safari 18. MDN tags it Baseline Newly available. Check the live MDN compatibility table for your own support targets.
Why do I need contain-intrinsic-size with content-visibility?
Skipped content has no natural size, so the element can collapse to zero height and cause layout shifts. contain-intrinsic-size supplies a placeholder size, and the auto keyword makes the browser remember the real size once the element has rendered.
Is content-visibility: auto bad for accessibility or search?
According to MDN, off-screen content under auto stays in the DOM and the accessibility tree, and remains available to find-in-page, tab navigation, focus and selection. Content under hidden does not, so reserve hidden for content you really want out of reach.
What is the difference between content-visibility: hidden and display: none?
Both hide the contents, but according to web.dev, display: none discards the rendering state, so showing the element again costs as much as rendering new content. content-visibility: hidden keeps the rendering state, so showing it again is cheaper.
Sources
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE