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

Sergey Filimonov
Sergey Filimonov
5,878 Points

Cannot pass the Task 4/6

Task 4/6 where I need to switch arguments to make the code invalid in the last exercise is not working :(

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

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

2 Answers

Kevin Kenger
Kevin Kenger
32,834 Points

Hey Sergey,

In order to switch the arguments, you need to make sure you're specifying which variable you want to assign the value to. Otherwise, you'd be assigning red to the $size variable and 10px to $color variable, which would make the code fail.

Try this:

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

.box {
  @include square($color: red, $size: 10px);
}