I have read through a number of articles on using srcset
for both device-pixel-density adjustments as well as art direction:
The State of Responsive Images in 2015 by Paddi Macdonnell
srcset Part 2: The W descriptor and sizes attribute by Rich Finelli
Neither of these makes it clear whether w-descriptors can be used without the sizes
attribute. Most indicate the contrary (w-descriptor work together with sizes
)
My own rudimentary testing confirms that image switching does work using only w descriptors.
I have found that when a number of different images are specified according to their width using the w-descriptor, the browser will choose the best image that will fit within a confined space.
No other code is necessary.
This is obviously confusing when designing responsive sites because, I as a designer only need the following cases:
- Change the image based on the device-pixel-density (Works for me. Great!)
- Change the image (art-direction) based on the available width (Works for me. Great!)
I am wondering how the sizes
would factor into this debacle. I do wholly appreciate that this is a new-ish feature.