How to lazy-load icons in a long gallery
Answer in brief
Use native lazy loading on images well below the initial viewport and reserve their dimensions. Place immediately visible artwork according to the page's initial rendering needs.
Profile a 200-item library
Mark later rows loading="lazy". Load the gallery with an empty cache, inspect the initial requests, then scroll several screens and confirm the next icons appear before they are needed in normal use.
Give placeholders a real height
A gallery full of unsized empty cells can initially collapse to a fraction of its final height. Reserve the thumbnail aspect ratio before images load. Inspect the first few rows with images blocked, then enable them and check both the request pattern and the scroll position.
Sources
- [1] HTMLImageElement: loading property - Web APIs — MDN Web Docs, accessed November 23, 2026
Frequently asked questions
Why are some offscreen icons already downloaded?
Browsers can begin fetching lazy images before they enter the viewport. The distance is an implementation decision.