HTML & CSS · Senior · Question 8 of 75
How does content-visibility: auto speed up long pages?
- 1It lazy-loads images and iframes inside the element, like
loading=lazy - ✓Correct answer: It skips layout and paint of off-screen elements until they're needed
- 3It removes invisible elements from the DOM and restores them on scroll
Explanation
The browser doesn't render sections outside the viewport, saving time on the first paint. To keep the scrollbar from jumping, set an expected size via contain-intrinsic-size: auto 500px. The DOM stays intact: find-in-page and accessibility keep working, unlike virtualization.