asp.net 2010 li:悬停颜色不变? [英] asp.net 2010 li:hover color doesn't change?
问题描述
我在表格单元格中列出了一些li元素......现在我的要求是如何改变颜色而li:hover ...我尝试了很多方法......但是我无法识别错误...
我还没有指定ul,但是我只是使用了li并且没有任何除法,因为在表格单元格中指定了li ...
谢谢
我的代码
< span class =code-keyword>< td > < li > < a href = services.aspx class = MyLiClass ; > 灾难恢复< / a > < / li > ; < / td >
我的CSS代码
.MyLiClass {display:block;文字修饰:无;颜色:银白色;背景色:#606060; FONT-FAMILY:宋体; font-size:10px; list-style:none;}
以下方法无效
.MyLiClass ul li a:hover,.MyLiClass ul li a.current {color:Red;}
.MyLiClass li a:hover,。MyLiClass li a.current {color:Red;}
.MyLiClass li:hover,。MyLiClass li.current {color:Red;}
.MyLiClass a:悬停,.MyLiClass a.current {颜色:红色;}
感谢指南
嘿那里,
在这一行中,
< td > < li > < a href = services.aspx class = MyLiClass > 灾难恢复< / a > < / li > < / td >您已设置 a 标记的 class 属性,但您期望 li 在悬停时更改为红色。
您应该设置 li 标记的类属性,如下所示:< td > < li class = MyLiClass > < a href = services.aspx > 灾难恢复< / a > < / li > < / td >
希望它有帮助:
祝你好运。
Azee ......
使用此代替您的代码
< table > < tbody > ; < tr > < td > < span class =code-keyword>< ul > < li class = MyLiClass > < a href = services.aspx > 灾难恢复< / a > < / li > < / ul > < / td > < / tr > < / tbody > < / table > 跨度>
I have a some li elements listed inside table cells...Now my requirement is how to change its color while li:hover...I tried many ways...but I can't identify the mistake...
And I have not specified the ul, but I simply used li and doesn't have any division, because li has been specified inside table cell...
Thanks
My Codes
<td><li><a href="services.aspx" class="MyLiClass";>Disaster Recovery</a></li></td>
My CSS codes
.MyLiClass {display:block; text-decoration:none; color:Silver; background-color:#606060; font-family:Courier; font-size: 10px; list-style:none;}
The below methods are not working
.MyLiClass ul li a:hover, .MyLiClass ul li a.current{color:Red;}
.MyLiClass li a:hover, .MyLiClass li a.current{color:Red;}
.MyLiClass li:hover, .MyLiClass li.current{color:Red;}
.MyLiClass a:hover, .MyLiClass a.current{color:Red;}
Thanks for the guidances
Hey there,
In this line,
<td><li><a href="services.aspx" class="MyLiClass">Disaster Recovery</a></li></td>you have set class attribute of a tag but you are expecting the li to change to red on hover.
Instead you should set the class attribute of li tag, like this:<td><li class="MyLiClass"><a href="services.aspx">Disaster Recovery</a></li></td>
Hope it helps:
Good luck.
Azee...
use this instead of your code
<table><tbody><tr><td><ul><li class="MyLiClass"><a href="services.aspx">Disaster Recovery</a></li></ul></td></tr></tbody></table>
这篇关于asp.net 2010 li:悬停颜色不变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!