Beyond Simple Responsive Images: Why Art Direction Matters
Responsive images solved the problem of serving appropriately sized images to different devices, but they don't address a crucial visual design consideration: sometimes an image that works perfectly on desktop becomes unusable on mobile. A wide landscape shot might lose its impact when cropped to a narrow mobile viewport, and a detailed portrait might become too small to appreciate on a large screen. This is where art direction comes in - the practice of serving different image compositions or crops based on the viewing context.
How the Picture Element Works for Art Direction
The HTML picture element acts as a container for multiple source elements, each specifying an image variant with conditions for when it should be used. The browser evaluates these sources in order and selects the first matching variant, then falls back to the img element if no sources match or if the browser doesn't support picture.
<picture>
<!-- Mobile crop (narrow) -->
<source
media="(max-width: 768px)"
srcset="hero-mobile.webp"
type="image/webp">
<!-- Mobile fallback -->
<source
media="(max-width: 768px)"
srcset="hero-mobile.jpg">
<!-- Desktop crop (wide) -->
<source
srcset="hero-desktop.webp"
type="image/webp">
<!-- Final fallback -->
<img
src="hero-desktop.jpg"
alt="Hero image description"
loading="lazy">
</picture>Adding Format Fallbacks for Modern Image Formats
The same picture element structure that enables art direction also provides the perfect mechanism for format fallbacks. By listing modern formats like WebP or AVIF first, followed by traditional formats like JPEG or PNG, you can serve optimized images to supporting browsers while maintaining compatibility with older browsers.
- 1Place modern formats firstList WebP or AVIF sources before traditional formats - browsers will use the first supported format they encounter
- 2Include type attributesAdd type="image/webp" or type="image/avif" to help browsers quickly identify supported formats
- 3Provide comprehensive fallbacksInclude JPEG for photographic content and PNG for graphics with transparency needs
- 4Always include final img elementThe img tag serves as the ultimate fallback and must include src, alt, and other standard attributes
Combining Art Direction with Format Fallbacks
The real power of the picture element emerges when you combine art direction with format fallbacks. This approach ensures that each viewport gets both the optimal composition and the optimal format, maximizing both visual impact and performance.
<picture>
<!-- Mobile - WebP -->
<source
media="(max-width: 768px)"
srcset="hero-mobile.avif"
type="image/avif">
<!-- Mobile - WebP fallback -->
<source
media="(max-width: 768px)"
srcset="hero-mobile.webp"
type="image/webp">
<!-- Mobile - JPEG ultimate fallback -->
<source
media="(max-width: 768px)"
srcset="hero-mobile.jpg">
<!-- Desktop - WebP -->
<source
srcset="hero-desktop.avif"
type="image/avif">
<!-- Desktop - WebP fallback -->
<source
srcset="hero-desktop.webp"
type="image/webp">
<!-- Final fallback -->
<img
src="hero-desktop.jpg"
alt="Detailed hero image description"
loading="eager"
width="1200"
height="600">
</picture>Best Practices and Common Pitfalls
While the picture element is powerful, improper implementation can lead to suboptimal results. Follow these guidelines to ensure your implementation works correctly across all browsers and devices.
- Order sources strategicallyPlace modern formats and specific media conditions first, general fallbacks last
- Include dimensionsAlways specify width and height on the img element to prevent layout shifts
- Use descriptive alt textProvide meaningful alt text that describes the image content
- Test across browsersVerify fallback behavior in older browsers and different devices
- Skip the img elementThe img tag is required and serves as the ultimate fallback
- Forget type attributesType attributes help browsers quickly identify supported formats
- Use overly complex media queriesKeep media queries simple and based on actual design breakpoints
- Neglect performance optimizationEnsure all image variants are properly compressed and optimized
Scaling Art Direction with Automation
Managing multiple image variants for art direction and format fallbacks can become complex at scale. Each breakpoint might require 3-4 format variants, meaning a single original image could generate 6-12 optimized versions. Automation tools can handle this complexity by programmatically generating all required variants from a single source image.
Automate image optimization with Optimagio
Doing this by hand for every image does not scale. Optimagio optimizes and converts your images (WebP and AVIF) automatically across your API, web app, and CMS — so every page ships the smallest possible files without manual work. See plans and pricing →