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 trialDeborah Savage
Front End Web Development Techdegree Student 6,794 PointsHow can I include the red border in the $color?
How would I go about adding color red to override default $color: black?
@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
Treehouse Project ReviewerSome 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);
}
Deborah Savage
Front End Web Development Techdegree Student 6,794 PointsDeborah Savage
Front End Web Development Techdegree Student 6,794 PointsThanks Jamie! :) Appreciate your help