rgba fallback for any attribute


/ Published in: SASS
Save to your folder(s)

rgba fallback for any attribute


Copy this code and paste it in your HTML
  1. // Source: http://thesassway.com/intermediate/mixins-for-semi-transparent-colors
  2. // example use:
  3. // @include alpha-attribute(color, rgba($lt-blue1, .9), #fff);
  4. @mixin alpha-attribute($attribute, $color, $background) {
  5. $percent: alpha($color) * 100%;
  6. $opaque: opacify($color, 1);
  7. $solid-color: mix($opaque, $background, $percent);
  8. #{$attribute}: $solid-color;
  9. #{$attribute}: $color;
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.