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

Eleeza Amin
Eleeza Amin
34,496 Points

Need help with Sass Mixins!!!

Hi Everyone, Please could you help me with this challenge, this is really hard to me and I cannot seem to get it right.

I'm on task 1 on code challenge: Introducing mixins. The instructions are: Define a mixin called "button" that sets the background to be #369 and the color to be white.

This is my code below:

@mixin button {
background-color: #369;
color: white;
}

When I run my code, I get the message: Bummer! The mixin needs to set the background attribute.

Any help would be most appreciated. http://teamtreehouse.com/library/introducing-mixins

Many Thanks to you all!

2 Answers

Erik McClintock
Erik McClintock
45,783 Points

Eleeza,

In this case, it seems the challenge is being a bit of a stickler - if you change the property from "background-color" to "background", your code will work fine.

Erik

James Barnett
James Barnett
39,199 Points

Good catch. In this case that seems like an overly specific code correctness test.

There's a submit feedback button at the end of every code challenge where you can tell the Treehouse team about any issues you ran into when working on a code challenge.

Eleeza Amin
Eleeza Amin
34,496 Points

I had changed background color to background and it worked! Thank you, Erik. Have a nice day!!

Eleeza Amin
Eleeza Amin
34,496 Points

Hi, I would like a full explanation of this challenge to understand it more. Thank you, everyone, especially those who posted answers and those who might be posting now.

Erik McClintock
Erik McClintock
45,783 Points

Eleeza,

What do you mean? That challenge as a whole (all the tasks), or just the first task that you had a problem with before?

Erik

Eleeza Amin
Eleeza Amin
34,496 Points

The one I had problems with.

Erik McClintock
Erik McClintock
45,783 Points

Eleeza,

As far as an explanation for the challenge and the problem you ran into, it really is as simple as the code that goes into Treehouse's editor was checking for something a bit too specific (i.e.it would ONLY accept "background" rather than "background-color", which technically works and is appropriate). There isn't anything new or different or wrong with your understanding of CSS or Sass, from that perspective. You were attempting something that should have been valid and correct; there was an error with the code in Treehouse's challenge, not with your code.

Simple as that :)

Erik

Erik McClintock
Erik McClintock
45,783 Points

Eleeza,

My pleasure! Does that help to clarify/answer your question?

Erik

Eleeza Amin
Eleeza Amin
34,496 Points

Yes, Erik. You've helped me in an exellent way!