Skip to content

Instantly share code, notes, and snippets.

@CooLNuanfeng
Last active August 29, 2015 14:04
Show Gist options
  • Save CooLNuanfeng/74043e1984b5474e7ae8 to your computer and use it in GitHub Desktop.
Save CooLNuanfeng/74043e1984b5474e7ae8 to your computer and use it in GitHub Desktop.
透明度的设置
.demo {
filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#4C000000', endColorstr='#4C000000');
}
:root .demo {
filter:none; /*处理IE9浏览器中的滤镜效果*/
background-color:rgba(0,0,0,0.3);
}
/*
透明度对应:
000000为十六进制颜色值
4C为透明度的对应 0.1 为 19;0.2 为 33 ; 0.3 为 4C; 0.4 为 66; 0.5 为 7F; 0.6 为 99; 0.7 为 B2; 0.8 为 CC; 0.9 为 E5; 1 为 FF;
rgba为十进制,颜色的十六进制要转化成十进制才可以。两个对一个值,六位数十六进制转换成三个十进制数值
*/
SASS封装函数
@mixin bg($opacity:rgba(0,0,0,0.5), $ie:'#7F000000'){
background: $opacity;
filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr=#{$ie}, endColorstr=#{$ie});
:root &{
filter:none;
background-color:$opacity;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment