XenonStack

Service Design

XenonStack Insights CSS content-visibility: Faster Rendering Guide

and | Published | Updated

CSS content-visibility guide: layers from CSS containment up to a faster first render

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.

Two-column diagram: visible, auto, hidden and contain-intrinsic-size on the left, with what the browser does for each on the right

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?

ValueWhat the browser doesWhen it fits
visibleDefault. No effect; contents are laid out and rendered normally.Anything that should always render.
autoTurns 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.
hiddenSkips 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?

MethodRendering stateCost to show againTakes space and receives clicks?
display: noneDiscardedAs much as rendering new contentNo, removed from layout
visibility: hiddenKeptLow, but the state is refreshed when neededYes, still takes space and can be clicked
content-visibility: hiddenKept; updates are applied when shown againLowContents 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?

BrowserFirst version with support
Chrome85
Edge85
Firefox125
Safari18

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?

SituationUse it?Why
Long article or documentation pagesYes, with autoMany below-the-fold sections that need no early rendering.
Product lists and feedsYes, with auto and a good size estimateLarge repeated blocks. Test scroll behaviour.
Inactive tabs or app viewsYes, with hiddenKeeps rendering state and makes re-showing cheaper.
Above-the-fold contentNoIt must render immediately.
Short, light pagesProbably notLittle work to skip; extra tuning has no payoff.
Content that must stay findable but is hiddenNo, avoid hiddenHidden content is not available to find-in-page.

A sensible adoption sequence

  1. Measure first with Lighthouse or your browser's performance tools.
  2. Apply content-visibility: auto to repeated below-the-fold sections only.
  3. Add contain-intrinsic-size: auto with a realistic length.
  4. Test scrolling for jumps, and test keyboard, find-in-page and screen reader behaviour.
  5. 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

Table of Contents

navdeep-singh-gill

Navdeep Singh Gill

Global CEO and Founder of XenonStack

LinkedIn profile

Navdeep Singh Gill is serving as Chief Executive Officer and Product Architect at XenonStack. He holds expertise in building SaaS Platform for Decentralised Big Data management and Governance, AI Marketplace for Operationalising and Scaling. His incredible experience in AI Technologies and Big Data Engineering thrills him to write about different use cases and its approach to solutions.

Get the latest articles in your inbox

Subscribe Now

Interested in Solving your Challenges with XenonStack Team
Get Started

Get Started with your requirements and primary focus, that will help us to make your solution

Please Select your Industry
Banking
Fintech
Payment Providers
Wealth Management
Discrete Manufacturing
Semiconductor
Machinery Manufacturing / Automation
Appliances / Electrical / Electronics
Elevator Manufacturing
Defense & Space Manufacturing
Computers & Electronics / Industrial Machinery
Motor Vehicle Manufacturing
Food and Beverages
Distillery & Wines
Beverages
Shipping
Logistics
Mobility (EV / Public Transport)
Energy & Utilities
Hospitality
Digital Gaming Platforms
SportsTech with AI
Public Safety - Explosives
Public Safety - Firefighting
Public Safety - Surveillance
Public Safety - Others
Media Platforms
City Operations
Airlines & Aviation
Defense Warfare & Drones
Robotics Engineering
Drones Manufacturing
AI Labs for Colleges
AI MSP / Quantum / AGI Institutes
Retail Apparel and Fashion

Proceed Next