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 Mixins Bummer -> "The height should be half the size variable."

Code challange - Stage 2 "Variables, Mixins, and Extending"

The height should be half the size variable.

@mixin button($size){ height: $size * 0.5; }

I've got "Bummer". Why ?

Cheers S

4 Answers

Just a hint:

You use "*" to multiply.

Its asking for a half :)

Matthew Mascioni
Matthew Mascioni
20,444 Points

Hmm, it seems like the challenge is asking for a bit more than just $size as an argument. Seems like it wants $color, too (unless I'm looking at the wrong challenge) This code worked for me:

@mixin button($color, $size){ height: $size / 2; width: $size; background: $color; }

But the whole point of this is to actually understand and help others to understand what is going on instead of giving away the solution...

Matthew Mascioni
Matthew Mascioni
20,444 Points

Absolutely. However, in his case, it seems to be an error in the Code Challenge engine; * 0.5 is the same as / 2.

Yeap

@Juan And it gets it :) @Matthew Yeach but I just wrote the part where I have a problem. Cheers, $size / 2; works for me but it's the same output as $size * 0,5;