css - 今天推荐使用哪些跨浏览器不透明度的 css 属性?

标签 css opacity

<分区>


想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它.

关闭 9 年前

我想知道现在在 css 中使用不透明度的建议是什么,这将适用于大多数浏览器和版本。

应该只有 opacityfilter 还是我还应该使用“-ms-filter”?

谢谢。

最佳答案

.transparent {
/* Required for IE 5, 6, 7 */
/* ...or something to trigger hasLayout, like zoom: 1; */
width: 100%; 

/* Theoretically for IE 8 & 9 (more valid) */   
/* ...but not required as filter works too */
/* should come BEFORE filter */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";

/* This works in IE 8 & 9 too */
/* ... but also 5, 6, 7 */
filter: alpha(opacity=50);

/* Older than Firefox 0.9 */
-moz-opacity:0.5;

/* Safari 1.x (pre WebKit!) */
-khtml-opacity: 0.5;

/* Modern!
/* Firefox 0.9+, Safari 2?, Chrome any?
/* Opera 9+, IE 9+ */
opacity: 0.5;
  }

今天使用。

.transparent {
zoom: 1;
filter: alpha(opacity=50);
opacity: 0.5;
}

source

关于css - 今天推荐使用哪些跨浏览器不透明度的 css 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23426127/

上一篇:javascript - 使用 fullpage.js 的水平 slider

下一篇:javascript - jQuery - 无法获取 td 的列号

相关文章:

javascript - 上下而不是左右的视差背景图像

html - css 转换不适用于显示 : none

firefox - 使用 CSS3 为显示 :none 设置不透明度动画

ios - 将 UISlider 链接到颜色的不透明度?

ios - CALayer, subLayer alpha覆盖

css - 如何使用 Compass 将不透明度从 0 过渡到 1?

javascript - 当图像超出限制时停止视差效果

CSS 2,使用链接元素导入的样式表的优先级

html - CSS 悬停在显示另一个不透明的图像上

javascript - 有没有办法交叉淡化相对定位的 div(具有动态高度)?