【发布时间】:2011-09-02 01:56:46
【问题描述】:
我在 IE9 中遇到了一件奇怪的事情,试图让背景渐变显示出来。
基本上我将多个类应用于容器对象。
<div class="gradient corners"></div>
使用这个 CSS。
.gradient {
background-color: #96A7C5;
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.19, #6C86AD),
color-stop(0.6, #96A7C5)
);
background-image: -moz-linear-gradient(
center bottom,
#75A33A 19%,
#8DC447 60%
);
.corners {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
为了在 IE 中获得渐变,我将过滤垃圾应用到我的 .gradient 类。
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8DC447', endColorstr='#75A33A');
这样,渐变效果有效,但我的圆角消失了。
所以我尝试为过滤器声明添加一个条件。
<!--[if IE]>
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8DC447', endColorstr='#75A33A');
<![endif]-->
这让我的角落恢复了,但渐变消失了。
【问题讨论】:
-
看看这个 SO 问题:stackoverflow.com/questions/4692686/…
-
在我的快速搜索中没有看到 - 谢谢,scurker。
标签: html css internet-explorer-9 conditional-comments