The HTML loading attribute
Quick answer
The HTML loading attribute tells the browser whether to lazy-load the resource until it nears the viewport. It is used on the <img> and <iframe> elements.
Overview
The loading attribute tells the browser whether to lazy-load the resource until it nears the viewport. It applies to the <img> and <iframe> elements.
loading="lazy" defers off-screen images and iframes until the user scrolls near them, cutting initial load. Do not lazy-load above-the-fold images (especially your LCP image) — that delays them.
Syntax
<img src="p.jpg" loading="lazy" alt="">
Values
| Value |
|---|
| eager (default) | lazy |
Best practices
Frequently asked questions
What does the loading attribute do?
Controls eager vs lazy loading of the resource.