Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Still hav'g troubles w/ Sass Code Challenge #2

For the Sass code challenge on the 2nd question http://teamtreehouse.com/library/advanced-nesting,

It prompts me to: Add another nested selector which makes all tags which are direct children of tags blue. I thought about it & entered: p { a { color: blue; } a { color: red; } } Realizing that probably wouldn't be correct, I saw in the lesson that he implemented "html.csscolumns & {". I tried that prior to making the anchor red as well as afterward. Neither syntax worked. I tried implementing the > before the anchor tag at the top all while knowing that, that would isolate that instance of the anchor & not the entire remainder of them whenever they were sought out. Also bearing in mind that it was asking me for "direct children".

What it was telling me was that when I'd type in something which might have been correct, it negated my previous task which was correct. That was to " make all of the tags nested inside the tag, red. So I even thought about going back to Guil's lesson where I inserted an "a span" but I know this answer deals with what I'm learning now which is Sass. Can anyone give me a hint?

2 Answers

Derek Briggs
Derek Briggs
2,757 Points

Remember that in Sass, the ampersand (&) is a representation of the the main element you are nesting within the element. You're on the right track by targeting the child anchor with the ">" selector though!

Avery Freeman-wheaton
Avery Freeman-wheaton
2,273 Points

I struggled with this one too. turns out I didn't quite understand the question:

Add another nested selector which makes all <a> tags that are direct children of <p> tags blue.

It seems as if the regular anchor tags for the rest of the page can be red, then, not just the paragraph section.

Here's code that passed:

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

Good luck!