Skip to content

Instantly share code, notes, and snippets.

@felipemorais
Last active December 15, 2015 21:49
Show Gist options
  • Save felipemorais/5328258 to your computer and use it in GitHub Desktop.
Save felipemorais/5328258 to your computer and use it in GitHub Desktop.
Responsive Image solutions
#srcset - http://www.w3.org/html/wg/drafts/srcset/w3c-srcset/
<img alt="The Breakfast Combo"
src="banner.jpeg"
srcset="banner-HD.jpeg 2x, banner-phone.jpeg 100w, banner-phone-HD.jpeg 100w 2x">
#picture tag - http://picture.responsiveimages.org/
<picture id="pictureElement">
<source media="(min-width: 45em)" srcset="large-1.jpg 1x, large-2.jpg 2x">
<source media="(min-width: 18em)" srcset="med-1.jpg 1x, med-2.jpg 2x">
<!-- assume media all -->
<source srcset="small-1.jpg 1x, small-2.jpg 2x">
<!-- the following are ignored -->
<source media=" is the message " srcset="">
</picture>
#Server side like sencha.io - http://www.sencha.com/learn/how-to-use-src-sencha-io/
<img
src='http://src.sencha.io/x50r20/http://sencha.com/files/u.jpg'
alt='Half the screen, rounded down to nearest 20 pixels'
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment