Skip to content

Instantly share code, notes, and snippets.

@mariiinda
Created January 8, 2013 10:12
Show Gist options
  • Save mariiinda/4482663 to your computer and use it in GitHub Desktop.
Save mariiinda/4482663 to your computer and use it in GitHub Desktop.
Sass mixin for cross browser transparency
@mixin rgba-bg($hex, $alpha, $ie: 0) {
@if $ie == 1 {
$rgba: rgba($hex, $alpha);
$ie-hex-str: ie-hex-str($rgba);
background-color: transparent !important;
background-color: $rgba;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#{$ie-hex-str},endColorstr=#{$ie-hex-str}) !important;
zoom: 1 !important;
}
@else {
background-color: $hex;
background-color: rgba($hex, $alpha);
}
}
#content {
@include rgba-bg(#FFFFFF, 0.8, 0);
}
.lt-ie9 #content {
@include rgba-bg(#FFFFFF, 0.8, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment