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 trialMatt Ferguson
19,404 PointsWhy is this incorrect?
I am having issues with the following questions "Define a box class. Use the square mixin to give it a height and width of 10px, and set the border to red."
Here is my code..
/* Write your SCSS code below. */
@mixin square($size, $color: black;) {
height: $size;
width: $size;
border: 1px solid $color;
}
.box {
@include square(10px, red);
}
Here is the response I am getting... "Bummer! The <div> with the class .box should have a red border. Did you include the square mixin correctly?"
I cannot figure out where I have made a mistake.
4 Answers
Staffan Mowitz
17,079 PointsI think it's the semi-colon after $color: black
in your mixin declaration that causes the problem.
Staffan Mowitz
17,079 PointsI don't really know what you mean by "closing that class". The whole mixin declaration should look like this:
@mixin square($size, $color: black){
height: $size;
width: $size;
border: 1px solid $color;
}
Mireille Pasos
35,469 Pointsare you closing that class? I don't see a closing curly bracket in your code.
Mireille Pasos
35,469 PointsHi,
Yeah I was talking about the part of the code where Matt included the mixin in the class, because I only saw this:
.box { @include square(10px, red);
But I just looked at it again and saw the curly bracket is there, just for some reason outside the code box in the post. Anywho, I think you're right, I just saw the semicolon you mentioned.