What are common causes of layout shifts and how to avoid them?

Cumulative Layout Shift (CLS) occurs when visible elements move unexpectedly during page load. Common
culprits include images without intrinsic dimensions, web fonts that swap late, ads or embeds that don’t
reserve space, and dynamically injected components. To mitigate CLS in the context of optimization,
ensure images—especially those above the fold—declare width and height or use aspect‑ratio boxes so the
browser can reserve space before the resource is fetched. When lazy loading, provide placeholders sized
to match the eventual media to prevent jumps.

For fonts, consider preloading critical font files and using font‑display strategies that minimize
reflow. If you inline Google Fonts or adjust loading behavior via the plugin, validate that text
rendering doesn’t shift after the initial paint. Avoid deferring scripts that are responsible for
establishing layout early on; if those run late, components may pop in and push other elements around.
Finally, test on mobile devices and slower connections where timing differences exaggerate layout
instability.

Combining these practices—explicit sizing, thoughtful media lazy loading, prudent script defer, and
sensible font strategies—keeps pages visually stable while still reaping the benefits of aggressive
performance optimizations.