/ Published in: SASS
rgba fallback for any attribute
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Source: http://thesassway.com/intermediate/mixins-for-semi-transparent-colors // example use: // @include alpha-attribute(color, rgba($lt-blue1, .9), #fff); @mixin alpha-attribute($attribute, $color, $background) { $percent: alpha($color) * 100%; $opaque: opacify($color, 1); $solid-color: mix($opaque, $background, $percent); #{$attribute}: $solid-color; #{$attribute}: $color; }