🧩 Fix a Picture Element Serving the Wrong Art Direction Source
A <picture> element evaluates its <source> elements in document order and picks the first one whose media condition matches, falling through to the final <img> only if none do — putting a narrower, more specific media query after a broader one means the broader source wins first and the specific art-direction crop never gets a chance to apply at all.
🔎 The Problem
<picture>
<source media="(min-width: 0px)" srcset="wide-crop.jpg">
<source media="(max-width: 600px)" srcset="mobile-crop.jpg">
<img src="wide-crop.jpg" alt="Hero banner">
</picture>
<!-- First source matches EVERY width, including mobile,
so mobile-crop.jpg is never selected -->
✅ Fix: Order Sources From Most Specific to Least Specific
- List narrower, more targeted
mediaconditions first and progressively broader ones after, since the browser commits to the first match it finds in document order and never backtracks. - Drop the artificial
(min-width: 0px)catch-all entirely and let the final<img>tag serve as the true default — that’s exactly what it’s there for. - Test by resizing the viewport in DevTools and checking the Network tab for which image file actually loads at each breakpoint, rather than trusting the markup order by eye.
The picture element doesn’t pick the best match — it picks the first match, so source order is the whole rule.





