IE8 中的不透明度适用于
但不在 上
我在使用 IE8 时遇到问题,无法使 元素透明。我发现了这些相关的问题,但我对那里提供的答案没有任何运气:
我已经尝试“给出布局”,通过使用 zoom: 1;
,但这并没有帮助。这是我的测试 CSS,取自 此页面 上的示例:
.test {
background-color: #6374AB;
width: 100%;
color: #ffffff;
zoom: 1;
}
.opaque1 {
opacity: .5;
}
.opaque2 {
filter: alpha(opacity=50);
}
.opaque3 {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
}
.opaque4 {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
}
以及测试 HTML :
<p class="test">Test paragraph without opacity.</p>
<p class="test opaque1">Test paragraph with <code>opacity</code></p>
<p class="test opaque2">Test paragraph with <code>filter</code></p>
<p class="test opaque3">Test paragraph with <code>-ms-filter</code></p>
<p class="test opaque4">Test paragraph with compatibility note</p>
<p>
<a class="test" href="#">Test anchor without opacity.</a><br/>
<a class="test opaque1" href="#">Test anchor with <code>opacity</code></a><br/>
<a class="test opaque2" href="#">Test anchor with <code>filter</code></a><br/>
<a class="test opaque3" href="#">Test anchor with <code>-ms-filter</code></a><br/>
<a class="test opaque4" href="#">Test anchor with compatibility note</a><br/>
</p>
在 IE8 中,opaque2
、opaque3
和 opaque4
段落是透明的,但没有一个锚点是透明的。在 IE6 中,opaque2
和 opaque4
段落和锚点都具有透明度。
I have a problem with IE8 where I cannot make <a>
elements transparent. I've found these related SO questions but I haven't had any luck with the answers provided there:
I've tried "giving layout", by using zoom: 1;
, but it hasn't helped. Here is my test CSS, lifted from the example on this page:
.test {
background-color: #6374AB;
width: 100%;
color: #ffffff;
zoom: 1;
}
.opaque1 {
opacity: .5;
}
.opaque2 {
filter: alpha(opacity=50);
}
.opaque3 {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
}
.opaque4 {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
}
And the test HTML:
<p class="test">Test paragraph without opacity.</p>
<p class="test opaque1">Test paragraph with <code>opacity</code></p>
<p class="test opaque2">Test paragraph with <code>filter</code></p>
<p class="test opaque3">Test paragraph with <code>-ms-filter</code></p>
<p class="test opaque4">Test paragraph with compatibility note</p>
<p>
<a class="test" href="#">Test anchor without opacity.</a><br/>
<a class="test opaque1" href="#">Test anchor with <code>opacity</code></a><br/>
<a class="test opaque2" href="#">Test anchor with <code>filter</code></a><br/>
<a class="test opaque3" href="#">Test anchor with <code>-ms-filter</code></a><br/>
<a class="test opaque4" href="#">Test anchor with compatibility note</a><br/>
</p>
In IE8, the opaque2
, opaque3
, and opaque4
paragraphs are transparent, but none of the anchors are. In IE6, the opaque2
and opaque4
paragraph and anchor both have transpareny.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试给锚点
display:block
,但是你必须修复它的 css 属性,如宽度、高度......等。但是一旦你给锚点设置了属性
display:block
,不透明度就会正常工作。根据评论,您可能会幸运地使用
display: inline-block;zoom:1
- inline-block 适用于 IE8,缩放将针对 IE 6/7。Try giving the anchor
display:block
, but then you will have to fix its css properties like the width, height .... etc.But once you give the anchor the property
display:block
the opacity will work fine.According to the comments, you may have luck with
display: inline-block;zoom:1
- The inline-block works on IE8, the zoom will target IE 6/7.