Don’t: duplicate markup by breakpoint
<img class="desktop" src="wide.jpg" alt="Team reviewing a prototype">
<img class="mobile" src="crop.jpg" alt="Team reviewing a prototype">Images · Responsive pattern
Responsive delivery may change file size, resolution, or crop. It should not create duplicate images or duplicate alternatives.
The principle
Use one <img> as the semantic image. Candidate sources choose pixels; the alt on that image communicates purpose.
Do / Don’t
Duplicating desktop and mobile images and hiding one with CSS can expose repeated alternatives when styles fail, create confusing reading order, and waste downloads.
<img class="desktop" src="wide.jpg" alt="Team reviewing a prototype">
<img class="mobile" src="crop.jpg" alt="Team reviewing a prototype"><img src="team-800.jpg" srcset="team-400.jpg 400w, team-800.jpg 800w" sizes="(min-width: 50rem) 50vw, 100vw" alt="Team reviewing a prototype">Choose the mechanism
Both patterns end in one <img>. The difference is whether candidates show the same composition or intentionally use different crops.
srcset + sizesUse width or density candidates when the content and crop stay the same. The browser selects an efficient resource.
<picture> + <source>Use art direction when a smaller viewport needs a meaningful crop. Put the only alt on the fallback <img>, not on <source>.
Art direction
<picture>
<source media="(max-width: 40rem)" srcset="team-close.jpg">
<source media="(min-width: 40.01rem)" srcset="team-wide.jpg">
<img src="team-wide.jpg" alt="Team reviewing a prototype">
</picture>alt="" on the single image.