Interview Question

What is lazy loading in HTML?

`loading="lazy"` lets the browser defer eligible off-screen images or iframes.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

Native lazy loading allows eligible images and iframes to load later when they are not near the viewport. • Use `loading="lazy"` on an `<img>` or `<iframe>`. • The value is a hint, so the browser decides the exact loading time. • Avoid lazy-loading important above-the-fold images that users need immediately.

💡 Simple Example

<img src="/images/gallery-12.jpg" loading="lazy" width="640" height="360" alt="A student painting a landscape">

⚡ Quick Revision

`loading="lazy"` lets the browser defer eligible off-screen images or iframes.