下面的代碼在ie 9中可以正常工作,並且不能在任何其他瀏覽器中使用。當我鼠標在名單背景懸停會改變顏色,但它不工作CSS懸停效果不起作用
.menunews ul{margin:0px;padding:0px;list-style-type:none;}
.menunews a{display:block;color:#266CAE;
height:30px;
background:#ffffff;border-bottom: 1px solid #ccc;overflow:hidden;width:100%;height:2.72em;line-height:2.75em;text-indent:2.02em;text- decoration:none;}
.menunews li a:hover{background:#ffffff;
background:-moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color- stop(47%,#f6f6f6), color-stop(100%,#ededed));
background:-webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
background:-o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
background:-ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
background:linear-gradient(to bottom, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed',GradientType=0);color:#266CAE}
的Html
<ul style="font-size:12px;"><li class="menunews"><a href="" >
<span style="margin-left:2px;">Hello test</span></a></li></ul></div>
menunews類,你剛纔提到它的利,因此CSS應該是li.menunews:懸停{....} – Pbk1303
做了UL的父DIV有.menunews類??,因爲你已經寫了這樣的CSS, – Pbk1303
http://jsfiddle.net/Kritika/L767M/看看這個jsfiddle – Pbk1303