HTML
<ul>
<li><a href="#">Home</a></li>
<li><a href="#" class="active">About</a></li>
</ul>
CSS
ul li:nth-child(even) a {
text-shadow: 1px 1px 1px red;
}
.active {
text-shadow: none;
}
And second list item still have shadow. why?
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.
it’s a matter of specificity: the first rule wins because it has a bigger specificity (calculated as 1 pseudoclass and 3 elements:
13) than the second (1 class only, no elements:10) : you should write insteador – in general – any other valid rule with a specificity greater or equal than
13.If you cannot change the second selector you may simply use
!importantapplied on the property, but its use should be limited as less as possible.For further information, see also: