Skip to content

Instantly share code, notes, and snippets.

@fotan
Created March 30, 2016 14:50
Show Gist options
  • Save fotan/472aa1f7b0a2f5439a3e8fa83307282b to your computer and use it in GitHub Desktop.
Save fotan/472aa1f7b0a2f5439a3e8fa83307282b to your computer and use it in GitHub Desktop.
SCSS - Opacity
/// Given an opacity value, generates that value as well as a way to display that opacity value in Internet Explorer 8 and 9.
/// @access public
/// @param {Float} $opacity - Opacity
/// @example scss - Usage
/// .foo {
/// @include opacity(0.5);
/// }
/// @example css - Result
/// .foo {
/// opacity: 0.5;
/// filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=#50)";
/// }
@mixin opacity($opacity) {
opacity: $opacity;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=#{$opacity * 100})";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment