I am not sure why my child selector isn’t working properly. In my example, only the direct <li> tag should have the red color. But instead, all <li> tags are colored red.
This is the jQuery fiddle of my problem:
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
My guess is that both your selectors have the same specificity + the color property is inherited.The color property is inherited.
Set first the default color for
<li>elements and apply a different color for the direct children.courses > ul > li:DEMO