Help me with CSS selectors, part 18

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

``` Result

hola1

hola2

hola3

```

In the CSS tab I have:

a:hover{text-decoration:none}
a:first-child{color:#cdbe70}
a:nth-child(3){color:#ffc125}

I understand that the error comes from that the <a> are the children of the <p>,so a:nth-child(3) would make the desired color in the third “a” inside a paragraph. But say that I want to keep the HTML code, with the paragraphs, how do I fix the CSS?

well, the paragraphs are first, second and third element of body so you should simply do:

p:nth-child(3)

then select the anchor element inside the paragraph:

p:nth-child(3) a

so we use the paragraphs for the counting

1 Like

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