I want to apply red background color to 1st li only i have tried several method but not able
to get what i want:
#rightmxmenu > ul > li:first-child > {background-color:#ca212d;}
#rightmxmenu > li:first-child > {background-color:#ca212d;}
it does not affect anything
here is my code and css
http://jsfiddle.net/gwdp3/1/
hope any expert can tell me what should i need to change.
Change this:
#rightmxmenu > ul > li:first-child > {
background-color:#ca212d;
}
to this:
#rightmxmenu > ul > li:first-child {
background-color:#ca212d;
}
jsFiddle example
You don't need the trailing >
.
Remove the last ">" made it for me.
#rightmxmenu > ul > li:first-child { background-color:#ca212d; }
#rightmxmenu > li:first-child { background-color:#ca212d; }
Hope this helps.
You may want to try using a class selector in the css and apply it to all your "first" menu items
.firstItem
{background-color:#ca212d;}
and in HTML use
<ul>
<li class ="firstItem"></li></ul>
This should work just fine:
#rightmxmenu ul li:first-child {
background-color:#ca212d;
}