Lazy loading images with HTML
It’s time to stop using JavaScript to lazy load images. Set the loading
attribute on <img>
tags to lazy
. The browser will load the image when the user scrolls to image. This attribute works with <iframe>
too.
<img src='image.jpg' loading='lazy' alt='Alt text...'>