网页前端开发中,为了实现一些特殊效果,需要将页面元素变透明,本文介绍用 CSS 实现支持 Firefox 和 IE 的 Alpha 透明效果。
IE使用私有属性filter:alpha(opacity),而标准的属性是opacity(CSS 3, Moz Family部分支持CSS3)。后面的数值是透明度,使用百分比或者小数。
filter:alpha(opacity=50); /* IE私有属性 */ opacity: 0.5; /* 支持CSS3的浏览器*/
IE中的HTML元素要实现透明,则其必须具备layout,这样的元素有仅可读的属性hasLayout,且其值为true。
还可以可以用 background-color: rgba() 来实现,同样可以实现透明效果,并且只应用于当前元素,不继承。
background:rgba(0, 0, 0, 0.3); filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#4c000000', EndColorStr='#4c000000');
Related Posts
- Amazon S3 存储桶无法删除
- 关闭Sublime Text更新检查
- Device supports arm64-v8a, but APK only supports armeabi on device *
- npm ERR! gyp verb `which` failed Error: not found: python
- c++ ‘-DNODE_GYP_MODULE_NAME=libsass’ ‘-DUSING_UV_SHARED=1’ ‘-
- Sublime Text 自动换行
- macOS中staff和wheel是什么?
- command not found: deno – macOS
- 语义版本控制