Click here to Skip to main content
15,891,926 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
HTML
<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
Posted
Updated 30-Sep-13 0:49am
v2

Hey there,
In this line,

HTML
<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:
HTML
<td><li class="MyLiClass"><a href="services.aspx">Disaster Recovery</a></li></td>


Hope it helps:

Good luck.

Azee...
 
Share this answer
 
v4
use this instead of your code
HTML
<table><tbody><tr><td><ul><li class="MyLiClass"><a href="services.aspx">Disaster Recovery</a></li></ul></td></tr></tbody></table>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900