WINDWARE.DEV · WEB DESIGN & DEVELOPMENT
Journal
·6 min read

Responsive Images for Service Site Layouts

A single full-size photo for every viewport wastes bandwidth and can slow LCP. How srcset, sizes, and picture—backed by MDN, web.dev, and the 2024 Web Almanac—fit a service website’s heroes, galleries, and cards.

Windware Studio· Design & Development Team

A service homepage often ships one hero photograph sized for a wide monitor. On a phone, the browser still downloads that file, then scales it down in CSS. The visitor pays for pixels they never see. On a redesign or new build, the fix is not “smaller JPEGs everywhere”—it is telling the browser which candidates exist and how wide the image will paint in each layout.

HTML’s responsive image tools—srcset, sizes, and the picture element—address two different problems. MDN’s responsive images guide names them clearly: resolution switching (same crop, different pixel counts) and art direction (different crops for different layouts). web.dev’s Learn Design course adds the delivery basics that keep those choices from shifting the page or delaying Largest Contentful Paint (LCP).


Why one file fails real layouts

Service sites rarely show one image size. A hero may span the full viewport on mobile and sit in a two-column band on desktop. A project gallery may show three cards across a laptop and one card across a phone. CSS can constrain overflow with rules such as max-inline-size: 100%, but constraining display size does not change which file the browser requested.

MDN frames the cost: embedding a large raster when a smaller one would do wastes bandwidth, especially on mobile networks; serving only a small raster makes the image look grainy when scaled up. In MDN’s worked example, an 800px fairy photograph is 128 KB on disk while a 480px version is 63 KB—a 65 KB saving on that single resource when the narrower candidate is chosen.

The 2024 HTTP Archive Web Almanac Media chapter (published 2024-12-29, updated 2025-01-02) shows why this matters at web scale: 99.9% of crawled pages requested at least one image; the median mobile page contained 13 img elements; and on 68% of mobile pages the LCP-responsible element involved an image. Images are not decoration—they often are the first paint visitors wait for.


How resolution switching works

For resolution switching, you keep the same composition and offer multiple widths. MDN’s pattern uses srcset with w descriptors (intrinsic widths) plus a sizes attribute that describes the layout slot under media conditions:

  1. The browser evaluates viewport size, density, zoom, and related factors.
  2. It finds the first true condition in sizes and reads the slot width.
  3. It picks a srcset candidate whose intrinsic width best matches that slot (preferring a slightly larger file when there is no exact match), then scales to fit.

web.dev requires the same pairing: if you use width descriptors, you must also supply sizes. Their example maps breakpoints to layout fractions—for instance, roughly one-third of the viewport in a three-column band, half in a two-column band, and full width on narrow screens—so the largest layout width does not always need the largest file.

When the painted size is fixed and only density changes, MDN and web.dev allow x descriptors (1x, 2x, 1.5x) without sizes. Do not mix w and x descriptors in one srcset.

MechanismProblem it solvesAuthor supplies
srcset + w + sizesSame crop, variable layout widthCandidates + slot hints
srcset + xSame CSS size, variable densityDensity candidates
picture + mediaDifferent crop / compositionExplicit source order
picture + typeFormat fallbacks (e.g. AVIF → JPEG)Typed sources + img fallback

A short analogy: sizes is like telling a courier the doorway width before they choose which crate to bring. Without that hint, they may bring the warehouse-sized crate every time.


When art direction needs picture

Resolution switching keeps faces and products in the same frame. Art direction changes the frame. MDN’s classic case is a wide landscape with people centered for desktop, replaced by a tighter portrait crop on narrow viewports so faces remain readable. The picture element lists source elements with media conditions; the first match wins. You still provide a final img with src and alt as the default and as a fallback for older agents.

web.dev also reminds teams to set width and height attributes so the browser can reserve space before the resource arrives, reducing layout shift. For below-the-fold images, loading="lazy" delays work until the image nears the viewport; for the above-the-fold hero, keep loading eager (the default) and consider fetchpriority="high" only when that image truly drives LCP—overusing high priority can delay scripts or fonts.


What the Almanac says about adoption—and mistakes

Responsive image markup is no longer exotic. The 2024 Almanac found srcset on 42% of mobile pages (up from 34% two years earlier), with w descriptors used far more often than x (62% vs 15% of srcsets on mobile). The picture element appeared on 9.3% of mobile pages.

Quality lags adoption. Median sizes attributes were 16% too large on mobile and 43% too large on desktop; on desktop, 20% of sizes values were wrong enough to change which srcset candidate loaded (14% on mobile). The Almanac estimates that a quarter of desktop pages using w descriptors waste 180 KB or more because of bad sizes, and the worst tenth approach a megabyte of excess image data. Lazy-loading reached about one-third of sites, yet 9.5% of LCP-responsible img elements were still lazy-loaded—an anti-pattern that slows the metric the hero was meant to own.

Only 32% of mobile img elements set both height and width attributes. Format mix is shifting—JPEG share fell while WebP and AVIF rose—but responsive selection still depends on honest markup, not only on modern codecs.

“A hero that looks sharp in the mockup still fails if the browser downloads a desktop file into a phone slot—or if lazy-loading delays the image that defines LCP.”
Windware Studio Practice Note


Limits worth stating

Responsive images do not replace compression, CDN delivery, or thoughtful photography. MDN notes that browsers begin downloading images early—before CSS and JavaScript finish interpreting the page—so you cannot reliably swap sources after measuring the viewport in script without often downloading two files. sizes is a hint: small inaccuracy is expected, but Almanac-scale errors undo the benefit of offering candidates. sizes="auto" (with lazy-loading) can let the browser use the real layout width, but support and fallbacks still need a deliberate plan.


Practical takeaways for your next website

  1. Inventory image roles: hero/LCP, in-content photos, card thumbs, decorative flourishes—each needs a different delivery plan.
  2. Ship width candidates for content photos and use sizes that match real CSS slots; audit with DevTools Network (and tools such as RespImageLint called out by the Almanac).
  3. Use picture for art direction when the crop must change; keep a complete img fallback with meaningful alt.
  4. Always set width and height (or equivalent aspect-ratio reservation) to protect layout stability.
  5. Lazy-load below the fold only; keep the LCP image eager, and use high fetch priority sparingly.
  6. Prefer modern formats where you control encoding, but treat format choice as complementary to responsive selection—not a substitute.

The next step is operational: define a small set of widths per template (hero, half-width, card) so editors and build pipelines produce the same candidates every time.


Ready to Discuss Your Website?

If you are planning a new website, a service redesign, or custom development for your business, we’re here to help shape the work.