我为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%')";
答案 0 :(得分:0)
它在旧浏览器中不起作用(如果我记得很好,它来自css3规范)。
让它在更多的浏览器上工作你可以使用svg背景,但它也不是最好的方式。