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 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;