New Perspectives On Web Design

(C. Jardin) #1
By Mat Marquis CHAPTER 5






If you don’t need to specify multiple resolutions for a given image
source, but do want to specify a source based on the layout, you can use the
picture element independent of srcset:





If you should only need the resolution-switching aspect, you can use
srcset independent of the picture element:


...

Not only can the two proposals harmoniously coexist and complement
each other, they can still solve problems on their own.
We proposed this version of the picture element to the HTML WG,
and a few months ago we reached First Public Working Draft^21 , which
means it’s time for implementers to start digging into it and asking us
questions. While we’re making steady progress, it might be some time
before we can use either of these exact markup patterns in our work.
All this doesn’t do us a hell of a lot of good right now, though — I mean,
this could be a while, and we’ve got work to do.
Fortunately, we can start using this markup today: Scott Jehl came up
with a polyfill for picture as we were writing the specification. Picturefill^22
emulates the picture element’s proposed behavior using divs and


21 http://www.w3.org/TR/html-srcset/
22 https://github.com/scottjehl/picturefill

Free download pdf