Need help with CSS Selectors


#1

I am having trouble changing the colors of three links while using
a:first-child {
color: #CDBE70;
}

a:nth-child(3) {
color: #FFC125;
}

The links are all turning the same color from the first-child code.
Here are the links I am using.
<p><a href="http://www.pandora.com/">Pandora</a></p>
<p><a href="https://www.codecademy.com/courses/web-beginner-en-WF0CF/3/5?curriculum_id=50579fb998b470000202dc8b"> Codecademy</a></p>
<p><a href="https://www.amazon.com/"> Amazon</a></p>

18 Show it if you know it! CSS Selectors is what I am on atm.


#2

the exercise sort of assumes you nest the links directly inside body, this would give different colors.

When you use paragraphs, all links are first child of paragraph. But wait, paragraph are first, second and third child of body, so we could use the paragraphs for the count:

p:first-child
p:nth-child(3)

and then select the link element inside the paragraph:

p:first-child a
p:nth-child(3) a

however, this code will not pass the exercise.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.