-
-
Save hiloki/951285 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<!-- | |
see http://www.modernizr.com/docs/#backgroundsize | |
--> | |
<script src="modernizr-1.7.min.js"></script> |
This file contains hidden or 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
/* devicePixelRatio=1 & devicePixelRatio未対応ブラウザ */ | |
.className { | |
width: 100px; | |
height: 100px; | |
background: url([email protected]); /* 等倍の画像 */ | |
-webkit-background-size: 100% 100%; /* 古いWebKit用 */ | |
background-size: 100% 100%; /* 100%にしといて .className の幅と高さを参照 */ | |
} | |
/* devicePixelRatio=1.5以上 */ | |
@media (-webkit-min-device-pixel-ratio: 1.5), | |
(min--moz-device-pixel-ratio: 1.5), | |
(-o-min-device-pixel-ratio: 3/2) { | |
.backgroundsize .className { | |
background: url([email protected]); /* 2倍の画像 */ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/886266 で moz--min-device-pixel-ratio となっていたが、
正しくは min--moz-device-pixel-ratio のはず。
たまたま device-pixel-ratio のことを調べていてぶつかったのでforkしてみた。