How to Lazy Load Images Natively in HTML

How to Lazy Load Images Natively in HTML

Ferenc Almasi β€’ 2020 September 28 β€’ Read time 1 min read
  • twitter
  • facebook
HTML

Simply use loading=”lazy” in img tags to lazy load them.

Copied to clipboard!
<!-- Use the loading attribute on images to defer the loading of offscreen images -->
<img src="lazy-loading.jpg" loading="lazy" />
loading.html

Please note that this feature is not widely supported, which means you need to provide fallback solutions. For the full list of supported browsers, check out the support table on caniuse.com.

If your browser does not support the loading attribute, it will simply ignore it, so you don't have to worry about introducing bugs.

How to Lazy Load Images Natively in HTML
If you would like to see more Webtips, follow @flowforfrank

How to Lazy Load Images Natively

Resources:

  • twitter
  • facebook
HTML
Did you find this page helpful?
πŸ“š More Webtips
Mentoring

Rocket Launch Your Career

Speed up your learning progress with our mentorship program. Join as a mentee to unlock the full potential of Webtips and get a personalized learning experience by experts to master the following frontend technologies:

Courses

Recommended

This site uses cookies We use cookies to understand visitors and create a better experience for you. By clicking on "Accept", you accept its use. To find out more, please see our privacy policy.