<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.>
I have used 2 brakelines betwen the Links(a) and While I was typing the a:nth-child(2) in the stylesheet.css tab, I’ve noticed that it counts <br/> as a <a> too. I mean if I wanted to select the second <a> I had to type 3 in the selector.
can someone plz tell me why?

I’m sorry I don’t understand what you mean. Its counting <br /> as a child ?

look. first they asked me to write three links. so i did that. i used a linebrake instead of a list to make each link be in a seperated line. then i went to the stylesheet tab to apply the color with the code a:nth-child(3){color:#FFC125} . and then i saw that instead of the third link, the second link changed its color. after deleting the br , everything got back to normal and the third link changed it’s color. i wanted to ask why this is happening and the linebraker is a problem here?

Let me explain this to you

a:nth-child(3) :arrow_right: This bit of code checks if the 3rd child is an a element and then applies the style

Now when you added <br>

Your code looked like this (I’m guessing):

<a href="#">ddb</a>   <!-- first child -->
<br>                  <!-- second child -->
<a href="#">fdfd</a>  <!-- third child -->
<br>                 <!-- forth child -->
<a href="#">fve</a>  <!-- fifth child -->

You understand what happened ?

1 Like

tnx Mam. I didn’t knew that it worked this way : “This bit of code checks if the 3rd child is an a element and then applies the style”

1 Like

Read this article for further explanation on how it works

1 Like

I just wanted to know whats the need to use the nth child or first child??
we can simply select that particular paragraph and style it right?

Its good to know the different ways of styling,

many don’t like inline styling so they will use this method or class’s/id’s

1 Like

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