--- title: "`` Is Not the Element You're Looking For" pub_date: 2014-09-30 09:30:23 slug: /blog/2014/09/picture-not-the-element-youre-looking-for tags: Responsive Images, Responsive Web Design metadesc: Most of the time the element is not what you want, just use img. Your users will thank you. code: True tutorial: True --- The `` element will be supported in Chromium/Chrome/Opera stable in a few weeks. Later this year it will be part of Firefox. Some of it is already available in Safari and Mobile Safari. It's also top of IE12's to-do list. The bottom line is that you can start using ``. You can polyfill it with [Picturefill][1] if you want, but since `` degrades reasonably gracefully I haven't even been doing that. I've been using ``. Except that, as Jason Grigsby recently pointed out, you probably [don't need ``][2]. See, two of the most useful attributes for the `` element also work on the good old `` element. Those two attributes are `srcset` and `sizes`. In other words, this markup (from, [A Complete Guide to the `` Element][3])... ~~~{.language-markup} Responsive Web Design cover ~~~ ...will do nearly the same things as this markup that doesn't use ``: ~~~{.language-markup} Responsive Web Design cover ~~~ The main difference between these two lies in the browser algorithm that ends up picking which image to display. In the first case, using the `` tag means the browser **MUST** use the first source that has a rule that matches. That's [part of the `` specification][4]. In the second bit of code, using the `sizes` and `srcset` attribute on the `` tag, means the browser gets to decide which image it thinks is best. **When you use `` the browser can pick the picture as it sees fit**. Avoiding the `` tag allows the browser to pick the image via its own algorithms. That means the browser can respect the wishes of your visitor, for example, not downloading a high resolution image over 3G networks. It also allows the browser to be smarter, for example, downloading the lowest resolution image until the person zooms in, at which point the browser might grab a higher resolution image. Generally speaking, the only time you need to use `` is when you're handling [the "art direction" use case][5], which, according to `` guru Yoav Weiss is [currently around 25 percent of the time][6]. The rest of the time, the majority of the time, stick with ``, your users will thank you. ## Further Reading * [Don't use `` (most of the time)](http://blog.cloudfour.com/dont-use-picture-most-of-the-time/) * [A Complete Guide to the `` Element](https://longhandpixels.net/blog/2014/02/complete-guide-picture-element) * [Native Responsive Images](https://dev.opera.com/articles/native-responsive-images/) * [Srcset and sizes](http://ericportis.com/posts/2014/srcset-sizes/) {^ .list--indented } [1]: http://scottjehl.github.io/picturefill/ [2]: http://blog.cloudfour.com/dont-use-picture-most-of-the-time/ [3]: https://longhandpixels.net/blog/2014/02/complete-guide-picture-element) [4]: https://html.spec.whatwg.org/multipage/embedded-content.html#select-an-image-source [5]: http://usecases.responsiveimages.org/#h3_art-direction [6]: http://blog.yoav.ws/2013/05/How-Big-Is-Art-Direction