Created
February 27, 2014 10:30
-
-
Save dieppon/9247744 to your computer and use it in GitHub Desktop.
Create cross-browsing alpha transparent backgrounds.
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
// RGBa background | |
@mixin background-rgba($color, $alpha) { | |
$rgba: rgba($color, $alpha); | |
$ie-hex-str: ie-hex-str($rgba); | |
// Fallback for web browsers that doesn't support RGBa | |
background-color: $color; | |
// Reset background to transparent only in IE 6-8 using the backslash 9 hack http://webdood.com/?p=57 | |
background-color: transparent\9; | |
// RGBa with $alpha opacity | |
background-color: $rgba; | |
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#{$ie-hex-str},endColorstr=#{$ie-hex-str}); | |
zoom: 1; | |
// Remove filter in IE9 | |
&:nth-child(n) { | |
filter: none; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment