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

Advanced Mixin Arguments Challenge 6 of 6

Use the mixin we just wrote to create a series of classes for the colors: red, orange, yellow, and green.

Why is this not 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: $color; } } }

.box { @include rainbow(red, orange, yellow, green); }

OUTPUT

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

.box .red { background: red; } .box .yellow { background: yellow; } .box .orange { background: orange; } .box .green { background: green; }

Please Help!

2 Answers

This isn't working because you are declaring your mixin inside of .box. It will work if you declare your mixin in the scss stylesheet without including it in a selector. If you look at the index.html file, you will see that the color classes are not declared within .box elements, so the the styles you create by including the mixin within .box would have no effect on the output.

Michael, that did it. Worked like a charm thank you so much.

Glad I could help :)