srcset: set of sources with w (width)
or x (resolution) descriptors.
1x (150 x 150 px)
2x (300 x 300 px)
3x (450 x 450 px)
CAUTION: srcset can be defined with w (width) or x (resolution)
descriptors but not both. They do not mix.
src: fallback ing if srcset is not supported.
http://www.smashingmagazine.com/2014/05/14/responsive-images-done-right-guide-picture-srcset/
Use Case: fluid image
Variable
Known by browser when
it’s loading the page?
viewport
dimensions
yes
image size relative
to viewport
yes via sizes
screen density yes
source files’
dimensions
yes via srcset
NOTE: We tell the browser the
rendered size of our images and the
browser picks the preferred image for
it’s container. Very Cool!
sizes: can be absolute (px or em), relative to the
viewport (vw), or dynamic calc(.333 * 100vw -12em)
http://ericportis.com/posts/2014/srcset-sizes/
TIP: Prefer picture element for art-directed and type-
switching use cases.
Use Case: art direction
Load art-directed (cropped) images when below 36ems
http://scottjehl.github.io/picturefill/#ie9
If the browser doesn’t find a compatible
source type it will fallback to the img
Use Case: type-switching
http://blog.cloudfour.com/responsive-images-101-part-7-type/