← Notes

content-visibility Is Not Free

Skipping off-screen rendering can help long pages, but an inaccurate intrinsic size still makes the scrollbar jump.

content-visibility: auto lets the browser skip layout and paint work for an off-screen section. The browser still needs an estimated size so it can calculate the scrollable area.

Pair it with a realistic contain-intrinsic-size. A wildly low estimate makes the document grow as sections approach the viewport, which moves the scrollbar thumb and can shift content. The optimization is most useful when repeated sections have predictable dimensions.