Technote

Performance optimization Practical

The first-screen image deserves special treatment

How fast a page feels is when the largest element on the first screen finishes drawing. Lazy-load the hero and you have delayed that moment yourself.

Lazy-loading every image on a site is a good habit: nothing below the fold is fetched up front and the initial load gets lighter. But there is exactly one image you must not lazy-load — the big one on the first screen. That is the image the visitor needs right now.

What perceived speed is measured by

Whether a page feels fast is well described by when the largest element on the first screen finishes drawing. Usually that is the hero image or a large heading. However quickly everything else arrives, if that element is late the page feels slow.

So for the first-screen image the question narrows to one thing: how soon does the browser find out this image exists? If the request starts late, a small file still paints late.

Discovery time is frequently the problem before file size ever is

Three things to get right

First, put it in the markup as an ordinary image tag. An image written into the HTML is found as the browser scans the document and the request starts immediately. A background image in a stylesheet is only found after the CSS has been fetched and parsed; an image inserted by a script waits for that script to run.

Second, do not lazy-load it, and raise its priority. It is worth telling the browser explicitly that this resource is needed now.

<!-- First-screen hero -->
<img src="/img/hero-1200.webp"
     srcset="/img/hero-800.webp 800w, /img/hero-1200.webp 1200w, /img/hero-1800.webp 1800w"
     sizes="(min-width: 992px) 60vw, 100vw"
     width="1200" height="750"
     fetchpriority="high"
     alt="…">

<!-- Images further down get the opposite treatment -->
<img src="/img/section.webp" loading="lazy" decoding="async"
     width="800" height="500" alt="…">

Third, always write the dimensions. With width and height present the browser reserves the space before the image arrives. Without them, everything below jumps the moment it lands — the same class of problem as a late font swap.

Preloading is not a cure-all

When the image really is a CSS background or lives inside a slider and the structure is hard to change, preloading can pull the discovery time forward. There is a trap, though: several preloads compete with one another. Preload a handful of font subsets and a few images at once and the largest element is the very thing that gets pushed back.

Six lines for the hero image — the last one means changing the structure

The fastest hero image is no image at all

One design option is worth leaving here. Build the first screen from typography and blocks of colour and the large image request disappears entirely. The largest element becomes the heading text, and text — given a font that arrives on time — paints far sooner than any photograph.

Businesses that genuinely need photography will of course use it. But “a hero needs a big photograph” is a convention rather than a requirement, and remembering that what goes on the first screen is partly a performance decision widens the options at design time.

The same subject as a checklist lives in the hero preload checklist, and image optimisation generally is covered in the images and media series. Measuring and fixing the bottleneck on a real page is part of our optimization program.

More on this topic

All technotes

Performance optimization Practical

Who pays for the milliseconds a tag adds?

A tracking script does not stop at downloading. While it is parsed and executed the main thread is busy, and a busy page ignores fingers. That cost is…

Marketers 5 min read

Performance optimization Practical

The object cache: what Redis actually removes

Repeated identical lookups disappear. One slow query does not. Miss that distinction and you will wire up Redis and then ask why nothing got faster.

Developers 7 min read

Performance optimization Practical

This is how a landing page gets heavy

Nobody decides to make a landing page heavy. It accumulates: one addition per campaign, and nothing ever removed when the campaign ends.

Marketers 6 min read

₩270,000 · Join the program