可能重复:
CSS - 为 IE 设置的渐变
我为 li 标签设置样式并悬停
.centermenu li
{
position: relative;
float: right;
cursor: pointer;
height: 32px;
width: 152px;
margin: 10px 0 0 10px;
color: #fff;
}
.centermenu li:hover, .centermenu li:focus
{
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,.2)), to(rgba(255,255,255,0)));
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.2), rgba(255,255,255,0));
background-image: -moz-linear-gradient(top, rgba(255,255,255,.2), rgba(255,255,255,0));
background-image: -ms-linear-gradient(top, rgba(255,255,255,.2), rgba(255,255,255,0));
background-image: -o-linear-gradient(top, rgba(255,255,255,.2), rgba(255,255,255,0));
background-image: linear-gradient(top, rgba(255,255,255,.2), rgba(255,255,255,0));
}
它在 Firefox 和 GoogleChrom 中设置,但不在 Internet Explorer 中。
我为 IE 设置了这段代码,但没有设置样式。
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFF 20%', endColorstr='#ffffff 1%');
/* For Internet Explorer 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFF 20%', endColorstr='#ffffff 1%')";