Skip to content

Instantly share code, notes, and snippets.

@Takazudo
Forked from tacamy/devicePixelRatio=1_1.5
Created March 11, 2011 08:23
Show Gist options
  • Save Takazudo/865619 to your computer and use it in GitHub Desktop.
Save Takazudo/865619 to your computer and use it in GitHub Desktop.
<!--
see http://www.modernizr.com/docs/#backgroundsize
-->
<script src="modernizr-1.7.min.js"></script>
/* devicePixelRatio=1 & devicePixelRatio未対応ブラウザ */
.className {
width: 100px;
height: 100px;
background: url([email protected]); /* 等倍の画像 */
}
/* devicePixelRatio=1.5以上 */
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio: 1.5) {
.backgroundsize .className {
background: url([email protected]); /* 2倍の画像 */
-webkit-background-size: 100px 100px; /* WebKit */
-moz-background-size: 100px 100px; /* moz */
-o-background-size: 100px 100px; /* opera */
background-size: 100px 100px; /* WebKit以外 */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment