Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Manpreet singh
Manpreet singh
4,826 Points

Sass: Advanced Nesting : make all <a> tags that are direct children of <p> tags blue.

GOT IT NEVER MIND

Aaron Witherspoon
Aaron Witherspoon
9,911 Points

Hi, I am stuck on this and wondering if you can help me. I am trying this : p { > a { color: blue; } a { color: red; }} And can't figure out why its not working... I even tried adding the '&' like Christopher suggested below. Any help would be great.

6 Answers

Fernando Teofilo
Fernando Teofilo
7,942 Points

This is what worked for me:

p { 
   a {
       color: red;
      }

   > a { 
    color: blue;
       } 
}

This seems backwards. The general is above the specific. I guess I'm use to the if/else from all the programming I have been learning on treehouse.

For anyone else interested..

/* CSS */
p > a { color: blue; }

/* SASS */
p { & > a { color: blue; } }
scott johnson
scott johnson
12,136 Points

This worked:

p {
  color: blue;
a {
   color: red;
}
}

/* Write your SCSS code below. */

p { color: red; a { color: red; }

a{ color:blue; } } All you have to do is add the > + the following code. a{ color:blue;}

/* Write your SCSS code below. */

p { color: red; a { color: red; }

a{ color:blue; } }

p {
color:blue;
}

p a {
color:red;
}

Try this. It worked for me. This may avoid SAS, however it gets the job done. As you can see, the links inside the paragraphs are being targeted.

Avoids Sass and therefore invalidates the lesson... yes, it does.

Solving the test in any way that specifically avoids Sass seems completely redundant and useless and defeats the entire purpose of learning and using Treehouse in general.