Skip to content

Instantly share code, notes, and snippets.

@johnrees
Created May 2, 2012 11:26
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnrees/2575957 to your computer and use it in GitHub Desktop.
Save johnrees/2575957 to your computer and use it in GitHub Desktop.
SASS/SCSS Internet Explorer Compatible Opacity Mixin
@mixin opacity($alpha) {
// IE 8
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=$alpha*100)";
// IE 5-7
filter: alpha(opacity=$alpha*100);
// Real Browsers
-webkit-opacity: $alpha;
-moz-opacity: $alpha;
-khtml-opacity: $alpha;
opacity: $alpha;
}
// 50% transparency
@include opacity(.5);
// no transparency
@include opacity(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment