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

Please Help

I get the error "The <div> with the class .red should have a red background. Did you use red as a parameter when including the rainbow mixin?"

@include rainbow(red, orange, yellow, green);

I believe I have done this properly, but please correct me if I am wrong. I cannot for the life of me get past this challenge...

1 Answer

Maybe you should post all of your code. That line passes task 6 correctly. You're on task 6, correct?

Sorry, Right.

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

@mixin rainbow($colors...) {
    @each $color in $colors {
    .#{$color} {
        background: $colors;
    }
  }
}

@include rainbow(red, orange, yellow, green);

Hmmm, i guess the mixin isn't fully checked in task 5.

You have background: $colors instead of background: $color

Maybe it only checks that the arguments and loop are setup correctly.

Thanks, that worked!