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

Challenge 6 of 6 Sass finals

the question is "Use the mixin we just created to create a class for the colors red ,orange, yellow and green."

Here is what I have and I keep getting a "Oops! It looks like task 3 is no longer passing"

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

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

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

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

}

thoughts?

2 Answers

Lauren Clark
Lauren Clark
33,155 Points

Check for whitespace issues, this seems to be a recurring sort of bug or uber strict completion flag for all the courses, this is the correct sass, compiles to what you have up there.

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

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

Ok new problem. I started playing around with it in Sublime. I got the correct output in sublime my css looks like this after being compiled.

.box {
  height: 10px;
  width: 10px;
  border: 1px solid red; }

.red {
  background: red; }

.orange {
  background: orange; }

.yellow {
  background: yellow; }

.green {
  background: green; }

But now in the code challenge 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?"