Created
June 12, 2013 13:18
-
-
Save jensgro/5765159 to your computer and use it in GitHub Desktop.
Sass-mixin to provide rgba for modern browsers and with a fallback for oldIE
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
// --- | |
// Sass (v3.2.9) | |
// --- | |
// Converts a solid color with an alpha-channel-value into rgba | |
// and an IE-filter as fallback for oldIE (IE up to version 8) | |
@mixin all-rgba($color, $alpha) { | |
$rgba: rgba($color, $alpha); | |
$ie-color: ie-hex-str($rgba); | |
background-color: $rgba; | |
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#{$ie-color}', EndColorStr='#{$ie-color}'); | |
zoom: 1; | |
} | |
.test { | |
@include all-rgba(#ccc, 0.75); | |
} |
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
.test { | |
background-color: rgba(204, 204, 204, 0.75); | |
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#BFCCCCCC', EndColorStr='#BFCCCCCC'); | |
zoom: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment