CSS content-visibility Property
The content-visibility property lets the browser skip rendering an element's content until it is needed, such as when it scrolls into view, speeding up page loads.
Description
The content-visibility property lets the browser skip rendering an element's contents until they are needed. It is one of the most effective performance tools for long pages: with content-visibility: auto, sections that are far off-screen are not laid out or painted, which can cut the initial rendering time of large documents dramatically.
When the contents are skipped the element behaves as if it had size containment, so it would collapse to zero height. Pair it with contain-intrinsic-size (for example contain-intrinsic-size: auto 500px) to reserve a placeholder size and keep the scrollbar stable. Skipped content stays in the DOM and remains available to find-in-page, links to fragments and assistive technology when the value is auto.
hidden skips the contents completely, like display: none but keeping the rendering state cached, which makes it fast to show again. The property can be animated with transition-behavior allow-discrete.
Definition
- Initial value
- visible
- Applies to
- elements for which size containment can apply
- Inherited
- no
- Computed value
- as specified
- Animatable
- discrete
- JavaScript syntax
- object.style.contentVisibility
Interactive Demo
Badge
Syntax
content-visibility: visible | auto | hidden;
Values
- visibleThe default. The contents are rendered normally.
- autoThe element gets layout, style and paint containment. If it is not relevant to the user (far off-screen, not focused, not selected), its contents are skipped. They remain searchable and accessible.
- hiddenThe element's contents are skipped entirely and are not accessible to find-in-page, tab order or accessibility tools, but their rendering state can be cached.
- initialSets the property to its initial value.
- inheritTakes the computed value of the parent element.
Example
Browser Support
The following information will show you the current browser support for the CSS content-visibility property. Hover over a browser icon to see the version that first introduced support for this CSS property.
Desktop





Tablets & Mobile





