SASS Opacity Mixin
CSS Opacity SASS MIxin For IE, FireFox, Chrome and Safari
@mixin Opacity($value){
$IEValue: $value*100;
opacity: $value;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity="+$IEValue+")";
filter: alpha(opacity=$IEValue);
}
How To Use
img.preload{
@include Opacity(0);
&.complete{
@include Opacity(1);
}
}
Written by Shavit
Related protips
3 Responses
Well done, thank you
over 1 year ago
·
Good job on this. I was making my own but was thinking i'd better check up on some other alternatives.
over 1 year ago
·
Thanks!
I changed the casing to fit our conventions, maybe suits someone else:
@mixin opacity($value){
$ie-value: $value * 100;
opacity: $value;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity="+$ie-value+")";
filter: alpha(opacity=$ie-value);
}
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#