Lazy Loading Images loading=lazy
Defer off-screen images with the native loading attribute.
The loading Attribute
<img loading="lazy" src="..."> tells the browser to defer downloading the image until it is about to enter the viewport. Native support across all modern browsers makes this the simplest performance win for image-heavy pages.
How "Near the Viewport" is Defined
Browsers use a small heuristic margin (usually a few thousand pixels below the fold). The image starts loading early enough that it is fully painted by the time the user scrolls to it — lazy loading is invisible to careful scrollers.
All lessons in this course
- The async and defer Attributes
- Preload Prefetch and Preconnect
- Lazy Loading Images loading=lazy
- Resource Hints modulepreload