CSS Selectors 18/23


If I wanted to do the lesson with the "li" to have my links under each other, how would the styling look in the css?

I can do it the normal way without the listing and complete the lesson. I think I must be writing the code wrong in CSS.

CSS eg:

ul {
list-style-type: none;

a:first-child {
color: #CDBE70;

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


all links are now are now first child of list (<li></li>), you can solve this problem by doing the following:

li:first-child a { 
  color: #CDBE70;
li:nth-child(3) a  {
    color: #FFC125;

list are first and third child of <ul>, so now it will work. This will most likely not pass the exercise


fantastic thankyou!!!

ul li a:first-child {

Thats how I was trying to write it.

It makes sense now to target the first bit and then have the rest written after like yours.

It doesn't matter really, it was just curiosity as I wanted it to look neater, but my attempts weren't working.

Thanks for the fast reply!!


I had same issue, found out that in this lesson tests expect that there will be space between selector & colon
body :first-child{

body :nth-child(3){


Thanks bytejumper - I was stuck for ages! Is this just a codecademy error or is this how it is supposed to be?