emptygif
Language: English

All languages and frameworks

Lazy-loading placeholder (lazysizes) HTML

A HTML snippet for Lazy-loading placeholder (lazysizes) that answers requests for /pixel.gif with the empty GIF, decoded once at startup.

Lazy-loading placeholder (lazysizes) HTML

File
index.html
<!-- The empty GIF keeps src valid until lazysizes swaps in data-src.
     (For most pages today, native loading="lazy" is enough.) -->
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
     data-src="/images/photo.jpg" class="lazyload"
     width="800" height="600" alt="A photo">

We ran this snippet and compared the bytes it returned.

Official site: Lazy-loading placeholder (lazysizes)

More in HTML