【发布时间】:2011-03-21 21:41:06
【问题描述】:
我的代码可以在 Chrome 和 Firefox 中运行,但不能在 IE8 中运行。
<a href="javascript:void();" class="shareActionLink" id="comment">
<img src="comment.gif" class="shareActionImage" />Comment
</a>
这个的CSS是:
.shareActionLink:link, .shareActionLink:visited
{
margin-right:8px;
color:#999;
opacity:0.6;
filter: alpha(opacity=60); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=60)"; /*IE8*/
background-color: #fff;
}
#shareActionsBox .shareActionLink:hover
{
color:#333;
text-decoration:none;
opacity:1.0;
filter: alpha(opacity=100); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=100)"; /*IE8*/
}
基于 StackOverflow 的其他帖子,我添加了 IE 过滤器,这有助于调整文本不透明度,但是,图像不透明度在 IE 中仍然没有改变。它在其他浏览器中运行良好。
我怀疑这是因为 img 嵌套在链接中。如何让图像在 IE 中改变不透明度??
谢谢
【问题讨论】:
-
只是为了试用,你可以尝试给你的
a标签的父级(可能是div左右)一个background-color: Blue(或任何其他颜色),看看是否然后过滤器工作?我记得有一个类似的问题是通过这种方式解决的。或者可能是a标签本身的背景颜色。 -
@Bazzz:我在发布之前添加了背景颜色。这是必要的,因为当您添加不透明度设置并添加背景使文本正确显示时,Firefox 使文本有点有趣。但是,这不是解决这个特定问题的方法。
标签: css