Use content-visibility: auto on substantial page sections that begin outside the initial viewport, and pair it with a realistic intrinsic size. Keep the first screen on the normal rendering path, then test scrolling, keyboard navigation and layout stability before expanding the change.
Choose a section whose rendering is genuinely expensive
A long page can have all its content in the document while asking the browser to postpone some layout and painting. That is the opportunity here. A detailed product comparison far below the introduction, a sequence of article cards or a long discussion can be worth investigating. A small paragraph is a poor first experiment if the page is actually waiting on a large script or an image download.
Record the existing page before selecting a boundary. Look for meaningful rendering work associated with content the reader cannot yet see. Choose one self-contained block with a predictable place in the page, rather than assigning the property to every descendant. Leave the header, introductory text and likely largest visible image outside that boundary. Check narrow and wide screens, because a section below the fold on one layout may appear immediately on another.
This technique does not remove elements from the DOM and is not a network lazy-loading switch. Keep download scheduling, image dimensions and script execution as separate investigations. If the transfer chart is unchanged after applying the CSS, that does not by itself mean the rendering change failed. Conversely, a shorter rendering interval does not prove that fewer bytes were downloaded. State which part of the loading process your experiment addresses.
Reserve space before the content is rendered
A skipped section still needs a useful outer size. Without a suitable estimate, its descendants can contribute little or no height while they are skipped, then change the surrounding layout when the browser renders them. The scrollbar and the reader's position can become misleading. Think of the placeholder as part of the page layout, not as a cosmetic skeleton overlay.
The contain-intrinsic-size shorthand supplies substitute dimensions under size containment. Its auto form allows a previously rendered size to be remembered and used on a later skipped pass. A fallback estimate is still necessary for the first encounter. A remembered size is not a promise that every future viewport, font or content change will produce identical geometry.
The following example targets a normal, vertically flowing section with width already determined by its container. The height is an illustrative starting estimate, not a measured recommendation for your site. Keep the default document usable when the feature query does not match.
@supports (content-visibility: auto) and
(contain-intrinsic-size: auto none auto 600px) {
.deferred-section {
content-visibility: auto;
contain-intrinsic-size: auto none auto 600px;
}
}Here the first value pair concerns width and the second concerns height. auto none avoids inventing a fixed intrinsic width, while auto 600px provides a fallback height until a rendered size is available. The MDN reference for intrinsic placeholder sizing explains these pairs. Do not replace this declaration with height: 600px: fixing the real height can clip or constrain content when it is visible.
Tune the estimate around actual content variations
Measure representative sections in their normal rendered state at the widths your audience uses. Separate compact cards from long comparisons instead of forcing both into one estimate. A placeholder that is sensible for a short description may be wildly inaccurate for a translated description, a large text setting or an expanded details panel. Keep those variations in the test set rather than treating the desktop screenshot as the complete layout.
Start with a small set of section classes if their structures differ substantially. For each class, document why the chosen estimate is reasonable and the circumstances that change it. You can adjust estimates at responsive breakpoints, but that is a hypothesis to verify, not a reason to introduce a complicated measurement system immediately. First establish whether a simple CSS change produces a worthwhile result.
Scroll through the section for the first time, move it offscreen and return. Those journeys exercise the fallback estimate and the remembered size differently. Also test a reload partway down the page and a direct fragment link. If the page jumps, inspect the content above the moving point and the placeholder it replaced. The site's guide to fixing cumulative layout shift offers useful context for investigating visible movement rather than guessing at the guilty element.
Preserve access to the offscreen content
The intended behavior of auto differs from hidden: offscreen content remains available to browser features such as find-in-page and focus navigation. Do not turn a performance optimization into a manual visibility state. Applying content-visibility: hidden to an article section would change whether readers can discover and reach its contents. Nor should ordinary offscreen paragraphs be marked aria-hidden simply because they are outside the viewport.
Test with the actual browser and assistive technology combinations you support. Begin keyboard navigation before the deferred section and continue through its links and controls without using the mouse to reveal it first. Search for a distinctive sentence deep inside the section. Follow its heading from a table of contents and check screen-reader heading navigation. A test that starts after everything has scrolled into view misses the important boundary.
Nested content that is intentionally hidden deserves separate attention. The documentation warns that skipped styling can affect how such descendants appear in the accessibility tree. Inspect duplicate labels, decorative elements and collapsed content in the actual tree. If an element really should be excluded, address its semantics carefully. Never put aria-hidden="true" on a focusable control or an ancestor containing controls that remain focusable. If the component cannot preserve correct navigation and exposure, leave that component out of the optimization.
Avoid asking JavaScript to undo the saving
The browser cannot keep skipping work that application code immediately demands. Review code that reads geometry inside the deferred subtree, including layout measurements made during initialization or scrolling. A component that repeatedly needs the exact size of every offscreen child is a poor partner for an optimization designed to avoid calculating those children yet. Identify the consumer of each measurement before changing it.
Do not add a loop that measures every skipped section merely to produce perfect placeholders. That can pay the same rendering cost you were trying to postpone. Prefer estimates derived during development, then profile the real application behavior. For a canvas or another independently drawing widget, rendering visibility and its own JavaScript activity are also separate concerns. This CSS does not automatically redesign the widget's update loop or data fetching.
Compare complete journeys, not only first paint
Use the same content, viewport, device conditions and cache state for a baseline and a changed run. Record initial loading, a steady scroll through the selected sections and an interaction inside one newly revealed section. Look at rendering work and visible behavior together. A first-screen improvement accompanied by a stutter when each section enters view may simply have moved the cost to a more noticeable moment.
Repeat the comparison instead of selecting the best trace. Note whether font loading, late images or asynchronous updates changed the section size between runs. Keep the network view available to distinguish transfer changes from rendering changes. The site's explanation of field data and lab data helps separate a controlled diagnostic trace from evidence about real visitors. Neither a single local recording nor a generic demonstration establishes the benefit on your production page.
Include resize, text zoom, restored scroll position and the longest realistic content variant. Inspect sticky descendants, positioned decorations and content that normally extends outside a section, because containment changes the boundaries the browser uses. Check a browser without the supported combination as well: it should show the normal document, even though it receives no deferred-rendering benefit. Do not make essential content depend on the optimization being available.
Ship a limited change with a clear rollback
Release the change to one understood component first. Keep its class and placeholder declaration easy to remove together, and save the baseline trace and navigation checks with the change. Record the actual result without converting a rendering observation into a guaranteed Core Web Vitals improvement. If the bottleneck remains elsewhere, it is reasonable to stop and investigate that other work rather than spreading the rule across the entire page.
An acceptable result needs more than fewer early layout tasks. Readers should still reach every relevant link, search the document, land at a fragment and scroll without a surprising change of position. Compare the initial estimate with the rendered section, then check the return visit to that section. When those checks pass and the measured rendering reduction justifies the added CSS, expand to the next component using the same evidence.