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 Sass Basics (retired) Getting Started with Sass Advanced Nesting

Wayne Hiner
Wayne Hiner
13,773 Points

Challenge 4 fails editor check.

As requested in the challenge, I added: .footer & { color: purple; } within the a within the p. The editor check fails with "Bummer! Please use the ampersand selector following the selector for the .footer div."

If I understand the challenge correctly, this code should work as it mirrors the examples in the lecture. I have also researched it extensively around the Web and my answer appears to be correct.

Can you please tell me if I have misunderstood the challenge request or is there a bug in the challenge or editor?

Many thanks, Wayne Hiner

index.html
<!DOCTYPE html>
<html>
<head>
  <title>Sass Basics - Code Challenge</title>
  <link rel="stylesheet" type="text/css" href="page-style.css">
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
  <h1>Hampton's Blog</h1>
  <div class="entry">
    <h1><a href="#">Delicious Food in SF</a></h1>
    <div class="content">
      <p>
        You know what my favorite restaurant in San Francisco is? The answer is that there are so many great restaurants that I couldn't choose one. But honorable mentions include <a href="#">Mr. Chow's</a>, <a href="#">Live Sushi</a> and <a href="#">Piccino</a>. 
        <span class="link"><a href="/info.html">Read More</a></span>
      </p>
    </div>
  </div>
  <div class="entry">
    <h1><a href="#">Great Music</a></h1>
    <div class="content">
      <p>
        Here are some of my favorite bands from years past and present: Belle and Sebastian, Pixies, and Daft Punk. Listening to music allows me to focus when I'm programming. 
        <span class="link"><a href="/info.html">Read More</a></span>
      </p>
    </div>
  </div>
  <div class="footer">
    <p>
      Thanks for reading my blog!  Be sure to check out my <a href="#">other articles</a>.
    </p>
  </div>
</body>
</html>
style.scss
/* Write your SCSS code below. */
p {
  a {
    color: red;
    .footer & {
      color: purple;
    }
  }
  > a {
    color: blue;
    &:hover {
      opacity: 0.5;
    }
  }
}

4 Answers

Because classes can be reused throughout a document, adding the div selector is needed to target only the .footer class within the div.

It has to do more with CSS specificity than Sass. Check out CSS Specificity: Things You Should Know, and for more information:

Hi Wayne, try div.footer since it's asking to target the class within the div.

Wayne Hiner
Wayne Hiner
13,773 Points

Hi Dustin; Thanks! That did work. I did not see that answer anywhere else on the Web, including the official Sass site. Do you happen to know if that's a browser idiosyncrasy or what? Wayne

Wayne Hiner
Wayne Hiner
13,773 Points

That's great. Thank you for the link. Excellent article.