Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.