19 May 2012
Last week I wrote an article for Treat Digital about A Responsive Web.
Basically, the point is that responsiveness is now the future. It will shape how we initiate site structure, content structure, design and develop. It will change workflow and there is also going to be a blurring of boundaries between designer, developer and content manager in the entire process.
This is not something that we can avoid and the exciting thing is that standards are being set. Right now. By us.
One set of standards that is being debated on at this very point in time is the issue regarding responsive images.
Standardising Responsive Images
Jeremy Keith wrote an article a couple of days ago about the standardising of responsive images. Currently there are different proposals being set out regarding this:
A new element called picturewhich will have the same effect asvideo does now.
<picture alt=”“><source src=“mobile.jpg” /><source src=“large.jpg” media=“min-width: 600px” /><source src=“large_1.5x-res.jpg” media=“min-width: 600px, »min-device-pixel-ratio: 1.5” /><img src=“mobile.jpg” /></picture>
By following the example of videothe behaviour of this new element can follow the specifications laid out for video and thus it means that the uploading of media will remain consistent within the HTML.
Another proposal is an extension parameter of imgcalled “srcset” whereby you can set a path to a different image when you declare a certain action which matches the device’s viewpoint. Taking Jeremy’s example:
<img alt=“image description” src=”/path/to/image.png” srcset=”/path/to/image.png 600w 400h”>
This means that the alternative image will be shown when the device’s viewport is 600px width by 400px height. The point is, that you can specify x amount of images for different scenarios within the img. As well as width and height you can specify pixel density of the viewport.
However Mat Marquis has responded to this proposed markup with less enthusiasm. I kind of agree with him, that the syntax for srcset can get into the realms of puzzling as it’s nothing that’s really be seen before in HTML or CSS. In terms of semantics, it doesn’t make sense to provide a plethora of images to be displayed in various situations for one img tag. It’s code that is within the HTML but seems to be acting like CSS.
Summary
These proposals are currently being debated, I think my preference may be for pictureas semantically this would make more sense and it will be consistent with the current standards for media uploads. They are all an alternative to media queries within the CSS, which is all pretty amazing stuff. I’m excited to see how this is resolved for the use of images in responsive design.
Sources:
Responsive Images and Web Standards at the Turning Point, Mat Marquis