Size and prioritize images

Set image dimensions, lazy-load below the fold, prioritize the hero.

From web-design-guidelines (Web Interface Guidelines), Images.

Reserve the space

Simulate a slow load and watch the paragraph.

No dimensionsBad

Field notes · 4 min

Ridge line at dusk

The last light catches the upper slope first, then the valley goes blue. Start reading here and keep your eye on this line.

<img src="dusk.jpg" alt="">0.000
width + height setGood

Field notes · 4 min

Ridge line at dusk

The last light catches the upper slope first, then the valley goes blue. Start reading here and keep your eye on this line.

<img width="1200" height="675">0.000
<img src="/dusk.jpg" width="1200" height="675" alt="Ridge line at dusk">
img { max-width: 100%; height: auto; }

Lazy-load below the fold

Scroll the feeds and compare the request counts.

EagerBad

    Requested 0 of 30

      <img width="640" height="360">
      loading="lazy"Good

        Requested 0 of 30

          <img width="640" height="360" loading="lazy">
          <img src="/feed/07.jpg" width="640" height="360"
               loading="lazy" decoding="async" alt="…">

          Put the hero first

          Load the page and watch when the hero lands.

          fetchpriority autoBad
          <img src="hero.jpg">–
          fetchpriority highGood
          <img src="hero.jpg" fetchpriority="high">–
          <img src="/hero.jpg" width="1600" height="900"
               fetchpriority="high" alt="…">

          Why it matters, pros and cons

          Why it matters

          Without dimensions the browser reserves nothing, so each image shoves the text.

          Pros

          • Zero layout shift from images.
          • Fewer bytes on first load.
          • The LCP image lands sooner.

          Cons

          • Never lazy-load the hero or above-fold images.
          • fetchpriority="high" on many images prioritizes none.
          • User uploads need dimensions stored at upload time.