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

Deborah Savage
seal-mask
.a{fill-rule:evenodd;}techdegree
Deborah Savage
Front End Web Development Techdegree Student 6,794 Points

How can I include the red border in the $color?

How would I go about adding color red to override default $color: black?

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

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

1 Answer

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

Some syntax errors you have: You have an invalid css property named $color which is the name of your variable, change that to the color property.

Your include directive is mispelt to inlude, rather than include.

In your mixin rule, first change the color property from red to the color variable. Having it currently a static red value means you arent making use of the mixin in terms of making it versatile.

To get your box class a red color value, simply add the size variable before the 50px value, or remove the color variable from the red value.

See example below for a solution to both:

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

.box { 
@include square(50px, red);
 }