Skip to content

Instantly share code, notes, and snippets.

@daneden
Created May 10, 2012 10:38
Show Gist options
  • Select an option

  • Save daneden/2652359 to your computer and use it in GitHub Desktop.

Select an option

Save daneden/2652359 to your computer and use it in GitHub Desktop.
Responsive Images
/* Responsive Images */
.r-img {
background-size: 100%;
display: inline-block;
zoom: 1;
*display: inline; /* Mimic inline-block on old IE */
}
@media screen and (max-width: 600px) { /* Hide background on low res */
.r-img {
background: none !important;
}
}
.r-img img {
display: block;
position: relative;
}
@media screen and (min-width: 600px) {
.r-img img {
opacity: 0;
}
}
<div class=r-img style="background-image: url(http://placedog.com/256/256);">
<img src="http://placedog.com/128/128">
</div>
{"view":"separate","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment