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 trialjohn larson
16,594 PointsTook a side trip down to Sass Basics...Use an @each loop to set the variable $color to the color red, then blue...
Use an @each loop to set the variable $color to the color red, then blue, and finally green. Use the loop to create three classes: .red_box, .blue_box, and .green_box. The background color for each class should be set to the corresponding color.
/*this is as far as I got
yes I'm totally lost
I'm going back to Sass w/Guill after this*/
@each $color in red, blue, green {
.something .#{$something}
background: $color;
}
/*this is the example the video gave
I can't quite seem to translate it over to this question*/
@each $member in thom, jonny, colin, phil {
.bandmember .#{$member}{
background: url("images/#{$member}.jpg");
}
}
john larson
16,594 PointsGood point Jason. Thank you. https://teamtreehouse.com/library/sass-basics/advanced-sass-concepts/creating-loops-with-for-and-each-2
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi John,
You're on the right track but your class selector needs to be more like what it was for task 1 of this challenge.
The selector from task1 was:
.item_#{$i}
In task 2 it wants the color followed by _box
.
That should be
.#{$color}_box
Let me know if you're still stuck.
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsHey John,
It would greatly help others help troubleshoot if you could provide a link to the challenge. :)