DEV Community

NITIN YADAV
NITIN YADAV

Posted on

Did you know you can optimize your website's load time by 50% with just one line of code?

By adding the loading="lazy" attribute to your images and iframes, you can defer loading offscreen content until the user scrolls near it. This simple change can significantly improve your website’s performance, especially on pages with multiple images.

Image description

It’s a quick win that boosts your site’s speed with minimal effort. Have you tried lazy-loading in your projects? Share your experiences or tips in the comments below!

Top comments (1)

Collapse
 
greenersoft profile image
GreenerSoft

The loading attribute with the value lazy can also be used with the iframe element. Add it, for example, with the embed code of a YouTube video (it's not added automatically by YouTube, as explained on this page).