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 Add Reusable Logic to Your Sass Advanced Mixins Challenge

Radha Krishna
Radha Krishna
4,615 Points

Not sure why $color:red is not accepted and throwing error instead

When declaring .box class, I did include the square mixin and passed necessary attributes. Bit puzzled why and what mistake i have made

style.scss
@mixin square($size, $color: black){
    $height: $size;
    $width: $size;
    $border: 1px solid $color;
}

.box{
    @include square($size:50px,$color:red);
}

2 Answers

Remove the dollar sign $ from each of the properties in the mixin, they should look like this:

height: $size;
width: $size;
border: 1px solid $color;
Radha Krishna
Radha Krishna
4,615 Points

Oh, silly me. Thank you for pointing out