Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

How do you use the picture element for art direction?

Illustration without a description Illustration without a description

Use picture when different layouts need different crops or compositions. Resolution switching for the same composition usually belongs in img srcset. Source elements define media conditions, and the nested img provides the fallback, alt text and intrinsic dimensions. The browser uses the first matching source.

 

<picture>
<source media="(max-width: 40rem)" srcset="portrait-640.jpg 640w, portrait-960.jpg 960w">
<source media="(min-width: 40.001rem)" srcset="wide-1200.jpg 1200w, wide-1800.jpg 1800w">
<img src="wide-1200.jpg" width="1200" height="675" alt="Designer presenting a prototype to the team">
</picture>

 

The alternative crops must communicate the same meaning so one alt attribute remains accurate. If the mobile crop removes a meaningful person, label or action described by the alt text, create a better crop or reconsider the composition. Art direction should improve clarity, not alter the content’s claim.

 

A source can also use the type attribute to offer modern formats before a fallback, though format selection and art direction can make markup complex. Keep media rules synchronized with the CSS layout and provide width or density candidates inside each source when multiple resolutions are useful.

 

Test which source loads through currentSrc and the network panel at each breakpoint. Include width and height on the img to reserve fallback aspect ratio, and use CSS if crops have different displayed ratios. Avoid overlapping media conditions whose source order selects an unexpected composition. Test the finished component with keyboard focus, touch input and a resized desktop window. Responsive geometry works only when controls stay reachable and the visual sequence matches the document order.