Last active
August 29, 2015 14:12
-
-
Save rakeshjuyal/0b2c614ca987a1f04ded to your computer and use it in GitHub Desktop.
mixin for retina images. ( _2x image for retina devices ).
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
/* | |
This is very basic mixin I created to cater retina images ( 2x ). | |
Modify this to suit your requirement. | |
*/ | |
@mixin retinafy($file, $type : png, $width : auto, $height : auto, $suffix : _2x) { | |
background-image: url($file + '.' + $type); | |
@media (min--moz-device-pixel-ratio: 1.3), | |
(-o-min-device-pixel-ratio: 2.6/2), | |
(-webkit-min-device-pixel-ratio: 1.3), | |
(min-device-pixel-ratio: 1.3), | |
(min-resolution: 1.3dppx) { | |
background-image: url($file + $suffix + '.' + $type); | |
background-size: $width $height; | |
} | |
} | |
/* Example */ | |
.glass { | |
@include retinafy( '/images/glass' , png , auto , 16px ); | |
} |
Author
rakeshjuyal
commented
Jan 6, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment