Responsive Images Community Group logo

We’re a group of developers working towards a client-side solution for delivering alternate image data based on device capabilities to prevent wasted bandwidth and optimize display for both screen and print.

Join Us!
Examples of art direction. See more demos of responsive images.

What is the `picture` Element?

The picture element is a markup pattern that allows developers to declare multiple sources for an image. By using media queries, it gives developers control as to when and if those images are presented to the user.

The picture element is one part of the HTML specification.

Sample Markup for `picture`
  <source media="(min-width: 40em)"
    srcset="big.jpg 1x, big-hd.jpg 2x">
    srcset="small.jpg 1x, small-hd.jpg 2x">
  <img src="fallback.jpg" alt="">

What are the `srcset` and `sizes` attributes?

The srcset and sizes attributes extend the img and source elements to provide a list of available image sources and their sizes. Browsers can then use this information to pick the best image source.

Both srcset and sizes are part of the HTML specification and can used separately or in conjunction with the picture element.

Sample Markup for `srcset` and `sizes`
<img src="small.jpg"
     srcset="large.jpg 1024w, medium.jpg 640w, small.jpg 320w"
     sizes="(min-width: 36em) 33.3vw, 100vw"
     alt="A rad wolf">

What are the use cases for each?

The Use Cases and Requirements document outlines the goals, objectives, and potential issues for end users that must be solved by the picture and srcset extension specifications.

View the Use Cases and Requirements

Where can I learn more?

The RICG on GitHub
IRC Logs
Discussion List Archives

Implementation status

This list indicates the status of implementation in major browser engines. We always try to keep this up-to-date but please refer to the linked issues for the latest status.
In most bugtrackers you can vote for implementation in the linked bugs.

30 closed issues

Issue Description Author Last Modified
275 IE11 <picture> rendered by JS 1 comment alexcracea 1961 days ago
272 URL interpolation? 3 comments tigt 2504 days ago
271 Moved to whatwg/html 1 comment zcorpan 2536 days ago
270 Revert "Adding baseline index.html" yoavweiss 2536 days ago
268 The `width` attribute 8 comments yoavweiss 2515 days ago
267 Writing to `currentSrc` 5 comments Wilto 2666 days ago
266 Add support for logical operators in media queries passed in sizes strings 1 comment przemyslaw-piatek 2701 days ago
262 Chrome renders image at viewport width 5 comments attiks 1960 days ago
259 Image density API 2 comments yoavweiss 2708 days ago
257 media-condition/mediaquery changes should only affect images in document 14 comments aFarkas 2730 days ago
256 Require default length in sizes (authoring req) 4 comments zcorpan 2735 days ago
254 Allow adaption of <figcaption> based on chosen <source> 17 comments Boldewyn 2808 days ago
253 Intrisinic dimensions adaptation only when sizes is explicit? 8 comments yoavweiss 2763 days ago
251 SVG format not loading in native picture element when specified in source element with type="image/svg+xml" 1 comment bjankord 2846 days ago
250 Update biblio.json mdmcginn 2846 days ago
249 onerror when environment changed? 4 comments yoavweiss 2834 days ago
248 naturalWidth/naturalHeight should maybe return null when no there's intrinsic size 1 comment zcorpan 2869 days ago
247 naturalWidth/naturalHeight should apply current pixel density zcorpan 2760 days ago
245 Drop any candidate with a `type` descriptor if `type` is not supported 9 comments eeeps 2872 days ago
244 Drop candidates with `w` descriptors if `w`is unsupported 3 comments eeeps 2872 days ago
242 media attribute with invalid value not parsed correctly 1 comment zcorpan 2887 days ago
241 Ban functions in sizes other than calc() 1 comment zcorpan 2892 days ago
240 Using 'width' value to determine which resource to pick 3 comments igrigorik 2902 days ago
239 Drop candidates with h without w 1 comment zcorpan 2877 days ago
237 Editorial: missing xref for "<code>srcset</code>" zcorpan 2926 days ago
236 Ref. #220 - Fixes missing `alt` attribute. 2 comments Wilto 2930 days ago
235 Closes #234 - Clarify that percentage-based values are invalid in `sizes` 1 comment Wilto 2926 days ago
234 Percentages not allowed in sizes="" 2 comments gregwhitworth 2927 days ago
233 Missing "normalize the source densities" step for sources coming from `<img>` 1 comment tabatkins 2937 days ago
232 Pipeline updates zcorpan 2926 days ago