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!

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


Robbie Thomas
Robbie Thomas
31,093 Points

Sass challenge @for and @each 2 of 2

I have:

@each $color in red, blue, green { .item.#{$color} { background: $color } }

I get the red light.

Obviously, Sass is not something I'm good at.


1 Answer

Jacob Miller
Jacob Miller
12,466 Points

You don't need the .item before the .#{$color}, and you need to add _box after .#{$color} so the class names are .red_box, .blue_box, and .green_box.

@each $color in red, blue, green {
    .#{$color}_box {
    background: $color;