Skip to content

Instantly share code, notes, and snippets.

@maddesigns
Created December 7, 2013 22:56
Show Gist options
  • Save maddesigns/7850881 to your computer and use it in GitHub Desktop.
Save maddesigns/7850881 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
// RGBA IE8 fallback
// based on http://thesassway.com/intermediate/mixins-for-semi-transparent-colors
//
// usage:
// @include rgba-fallback(rgba(red, 0.6), white);
// @include rgba-fallback(rgba(red, 0.6), white, 'color');
@mixin rgba-fallback($color, $background, $attribute: background-color) {
$percent: alpha($color) * 100%;
$opaque: opacify($color, 1);
$solid-color: mix($opaque, $background, $percent);
#{$attribute}: $solid-color;
#{$attribute}: $color;
}
.button {
@include rgba-fallback(rgba(red, 0.6), white);
}
.button {
background-color: #ff6666;
background-color: rgba(255, 0, 0, 0.6);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment