Skip to content

Instantly share code, notes, and snippets.

@jesperbjensen
Last active December 11, 2015 00:38
Show Gist options
  • Save jesperbjensen/4517454 to your computer and use it in GitHub Desktop.
Save jesperbjensen/4517454 to your computer and use it in GitHub Desktop.
A simple css file, for adding support for CSS-classes that gives you the ability to serve high-resolution images.
.hidden-normal-res {
display: none;
}
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
.hidden-high-res {
display: none;
}
.hidden-normal-res {
display: inherit;
}
}
<img class="hidden-high-res" style="width: 100px; height: 100px" src="100x100.png" />
<img class="hidden-normal-res" style="width: 100px; height: 100px" src="200x200.png" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment