html - 颜色透明在 IE 中不起作用

标签 html css

我可以在 Firefox 和 chrome 中获得此功能。但在代码下方,文本显示在 IE 中。该文本不应显示。

<a target="_blank" href="#">edit</a> 
<style>
    a {
        background: url("../images/edit1.gif") no-repeat scroll 0 0 transparent;
        color: transparent !important;
      }
</style>

最佳答案

IE 5-8 大多不支持透明属性。但是IE 9会支持它。

在搜索我的博客时,我发现了以下方法

.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;
} 

我在 Blog 1 中提到了这个和 Blog 2

关于html - 颜色透明在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13800913/

相关文章:

css - 基于多个按钮选择的过滤器

html - 如何将 bootstrap 导航栏调整为 900px 并将其置于页面中心

animation - Firefox 和 IE 中的 css 关键帧动画

jquery - Bootstrap 滚动下拉菜单

html - 在屏幕中心对齐文本

javascript - Node.js + Phaser MMO

javascript - 在jQuery中获取IMG标签的ID

javascript - 如何在隐藏/显示另一个元素时更改一个元素的 CSS(没有自定义事件)?

javascript - 如何更改指令中元素的 css 类?

css - 更改字体样式 wrt @font-face 支持