EDIT: We can all agree that the picture element can become very verbose. Especially if you are thinking about supporting a wide range of devices with multiple screen sizes/resoltions.
I’ve put together an example of some markup that would help allievate this issue based on image-set() CSS and URI Temapltes.
View Example Mark-Up – https://gist.github.com/2572749
Big thanks to Adam Bradley for his feedback on this and helping me understand why this makes so much sense as an alternative way to author picture elements which makes them easier to maintain and keeps our markup DRY.
Also, Philip Ingrey reminded me that these can all be in one media query and that each vendor prefixed device pixel ratio doesn’t need to be in an individual media query. I must have had a mind blank when I originally wrote this. I’ve updated the markup to show his example which I think is a perfect solution to the “issue” I was describing. I’ve also moved some of the code examples to github.
<picture alt="Alt tag describing the image represented"> <source src="photo.jpg"/> <source src="email@example.com" media="-webkit-min-device-pixel-ratio:2,-moz-min-device-pixel-ratio:2,-o-min-device-pixel-ratio: 2/1,min-device-pixel-ratio:2"/> <img src="photo.jpg" /> </picture>
As more and more high-resolution devices come out, from smart phones, to tablets, to laptops and desktops, I think we will start to need 2 images for each breakpoint. Where originally the picture element might have been used like so: https://gist.github.com/2509519
I feel like a more realistic example of the picture element being used in the future will be: https://gist.github.com/2509534
I’m glad Philip reminded me of my mistake, because the markup I had imagined to handle all the vendor prefixes to do this was crazy.
On a side note, I’d love to see the user be able to choose if they want high-resolution graphics in their browser, just like they can choose their default font-size. Maybe an option where you can pick SD graphics and HD graphics. If they choose SD, it would say their device had a pixel ratio of 1 rather than 2 even if they were on a retina device.