Posted on: 30/05/2026(updated)
Images and <iframe> elements consume significant bandwidth and processing power. Deferring the loading of these off-screen elements (lazy loading) frees up bandwidth for critical assets, improving performance metrics like Largest Contentful Paint (LCP) for images and Interaction to Next Paint (INP) for iframes.
Modern browsers natively support lazy loading using the loading attribute on <img> and <iframe> elements. It accepts two primary values:
Note for <picture> elements: The loading="lazy" attribute must be placed on the child <img> tag, not the <picture> container.
You should never lazy load elements that are likely to appear in the initial viewport (above the fold), such as hero images or top-of-page elements.
loading="lazy" to a visible image delays its fetch, harming LCP performance.<iframe> ElementsIframes are full HTML documents that pull in their own heavy subresources (especially JavaScript), which can bottleneck the main page thread and hurt interaction responsiveness.
For interactive elements like video players (YouTube, Vimeo) or chat widgets, a facade is highly effective.
Because native browser lazy loading is restricted to <img> and <iframe>, you must use JavaScript libraries (like lazysizes or yall.js) to lazy load unsupported elements:
<video> elements, and video poster images.src attribute to trigger the network request.