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 (retired) Advanced Sass Concepts Advanced Mixin Arguments

Why 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
Staffan Mowitz
17,079 Points

I think it's the semi-colon after $color: black in your mixin declaration that causes the problem.

Staffan Mowitz
Staffan Mowitz
17,079 Points

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

are you closing that class? I don't see a closing curly bracket in your code.

Hi,

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.