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 Sass Basics Improve Your Workflow with Sass Write a Mixin

David Moorhead
David Moorhead
17,992 Points

Help is already appreciated for a simple SCSS code I can't seem to discover.

Challenge Task 2 of 4

Next, create a new rule to specify that all <a> tags should include the styles defined inside the button mixin.

Bummer = The background color for 'a' tags should be the value of '$btn-background' - did you include the mixin?

Is there a clue to the correct answer from the Bummer? :)

style.scss
$btn-background: #dc143c;

/* Write your SCSS code below. */

@mixin button {
  font-size: 1.25em;
  $btn-background: #dc143c;
}
a  {
  @include button;
}

4 Answers

Michael Hulet
Michael Hulet
47,843 Points

Your code to include the mixin looks just fine to me, but you have a syntax error in the mixin itself. $btn-background is a variable, which means it holds a value. The first line of the challenge (provided by Treehouse, not in the code you wrote) tells Sass "remember from now on that when I say `$btn-background', I actually mean #dc143c". The value that's inside $btn-background isn't as important to know as just that $btn-background is a container for a value.

Now, combine that knowledge with the challenge's instructions. You're supposed to assign whatever value is inside the $btn-background variable to the property background-color. Once you fix that line inside your mixin, you should be good to go!

I will be back

David Moorhead
David Moorhead
17,992 Points

Thank You, Michael !! You're good to have taken time to fully explain.

Funny thing is, early on, I assumed passing Task 1 meant Task 1 was accurate, and in this case, it wasn't. I think I've got the distinction now.

G'day! :)

Here is the REAL ANSWER:

[Moderator redacted]
Michael Hulet
Michael Hulet
47,843 Points

Hey Sekoyya!

For future reference, it's frowned upon in the Community to post code that can be copied and pasted and just work without explanation. As such, I've redacted the code in this answer. If you'd like to re-post your code, feel free to do so, but make sure it illustrates how to solve the problem without actually being copy/pastable to solve it. Also, be sure to include a good explanation about how and why it's the correct solution to the problem. Thanks for helping out in the Community!