Junior JavaScript

What is lazy loading in HTML5?

Lazy loading defers loading of non-critical images or iframes until they are visible in the

viewport — improving page speed.

Example:

<img src="photo.jpg" loading="lazy" alt="Nature view">

Key Takeaway:

loading="lazy" helps reduce initial load time and saves bandwidth.

More from JavaScript Tutorial

All questions for this course