Created
February 7, 2015 01:25
-
-
Save denisinla/34a2cbeda1c3e2bcaefa to your computer and use it in GitHub Desktop.
Media Query for targeting device ratio and DPI.
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
.box { | |
background: url( 'img/box-bg.png' ) no-repeat top left; | |
width: 200px; | |
height: 200px; | |
} | |
@media only screen and ( -webkit-min-device-pixel-ratio: 1.3 ), | |
only screen and ( min--moz-device-pixel-ratio: 1.3 ), | |
only screen and ( -o-min-device-pixel-ratio: 2.6/2 ), /* returns 1.3, see Dev.Opera */ | |
only screen and ( min-device-pixel-ratio: 1.3 ), | |
only screen and ( min-resolution: 124.8dpi ), | |
only screen and ( min-resolution: 1.3dppx ) { | |
.box { | |
background: url( 'img/box-bg@2x.png' ) no-repeat top left / 200px 200px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment