Last active
September 26, 2015 21:07
-
-
Save anselmh/1158855 to your computer and use it in GitHub Desktop.
responsive attribute for HTML/CSS3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- backwards compatible solution --> | |
<!-- the browser should read media-query and then download the right file for the actual screen size --> | |
<img media-xs="(min-width:640px)" media-xs-src="http://cdn.url.com/img/myimage_xs.jpg" media-m="(max-width:1024px)" media-m-src="http://cdn.url.com/img/myimage_m.jpg" media-xl="(min-width:1025px)" media-xl-src="http://cdn.url.com/img/myimage_xsl.jpg" src="http://cdn.url.com/img/myimage_xs.jpg" /> | |
<img media-xs="(max-width:640px)" | |
media-xs-src="http://cdn.url.com/img/myimage_xs.jpg" | |
media-m="(max-width:1024px)" | |
media-m-src="http://cdn.url.com/img/myimage_m.jpg" | |
media-xl="(min-width:1025px)" | |
media-xl-src="http://cdn.url.com/img/myimage_xsl.jpg" | |
src="http://cdn.url.com/img/myimage_xs.jpg" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
changed code to a better and backwards compatible solution.