Created
June 7, 2014 17:59
-
-
Save bcinarli/7fe71c7daae450b6774a to your computer and use it in GitHub Desktop.
Retina background image. Uses a $retina-suffix variables for retina & normal image files
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
/* @author Bilal Cinarli */ | |
/** ------------------------------------------- | |
Media Query Mixins | |
------------------------------------------- **/ | |
/** | |
* Retina Image | |
*/ | |
@mixin retina-image($image, $ext: 'png'){ | |
background-image: url('#{$images}#{$image}.#{$ext}'); | |
@include retina(){ | |
background-image: url('#{$images}#{$image}#{$retina-suffix}.#{$ext}'); | |
} | |
} | |
/** | |
* Retina | |
*/ | |
@mixin retina($ratio: 1.5){ | |
$dpi: 96*$ratio; | |
@media only screen and (-webkit-min-device-pixel-ratio: $ratio), | |
only screen and (min--moz-device-pixel-ratio: $ratio), | |
only screen and (-o-min-device-pixel-ratio: $ratio/1), | |
only screen and (min-resolution: #{$dpi}dpi), | |
only screen and (min-resolution: #{$ratio}dppx) { | |
@content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment