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

David Moorhead
David Moorhead
18,005 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,912 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
18,005 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,912 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!