First-child & nth-child!


#1

I am doing 18.Show it if you know it exercise & why my code doesn't work by defining a unordered list for links? whats wrong with ul and code?
this:

<head>
    <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
    <title>Result</title>
</head>
<body>
<ul>
    <!--Add your HTML below!-->
    <li>
    <a href="https://www.codecademy.com">Learning</a>
    </li>
    <li><a href="http://s5.picofile.com">Movie</a></li>
    <li><a href="https://www.google.com">Google</a></li>
    </ul>
</body>

but the tester says it's true when my code doesn't work correctly!!!(the color doesn't change as it should)


Lesson 18: Show It If You Know It! Entire CSS Not Working?
#2

what do you use as css selectors? a:first-child and a:nth-child(3)?

because you decided to use a list, the links are both first child of <li></li>, you could use the following css selectors to resolve the issue: li:first-child a and li:nth-child(3) a, this does work because list tag are first and third child of unordered list (<ul></ul>)


#3

I tried it, but it didn't work too!
it just change the circle object before link texts!!


#4

make sense right? link is programmed not to inherit from its parent. that is why, i used li:first-child a, and you used li:first-child. See the difference? i specify link (a) as well, after is specified li:first-child


#5

yeeeees! thnx alot :smile: