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 trialKabolobari Benakole
Courses Plus Student 14,278 PointsUnable to Solve
Can you solve this challenge without touching (reformating) the $teams
list? I mean in the teacher's example it was easy - two space-delimited items so the each directive with one added-in variable matched things easily. But now you got 4 items in each list - it's confusing how to solve it.
$teams: (GreenBay Packers green yellow) (Seattle Seahawks blue green) (Chicago Bears blue orange);
@each $team in $teams {
.#{to-lower-case(nth($team, 1))} {
background-color: nth($team, 3);
border: 1px solid nth($team, 4);
&:after {
content: 'Your' + ' ' + nth($team, 1) + ' ' + nth($team, 2);
color: nth($team, 4);
}
}
}
1 Answer
Kabolobari Benakole
Courses Plus Student 14,278 PointsI actually solved it. Here's what I heard in the review video and it nailed it for me:
So, this is actually a really, really cool example of being able to go through a list iteratively, and then depending on how many values are inside of each object within that list, then you can assign individual variable names to each part of it.
$teams:
(GreenBay Packers green yellow)
(Seattle Seahawks blue green)
(Chicago Bears blue orange)
;
@each $a, $b, $c, $d, $team in $teams {
.#{to-lower-case($a)} {
background-color: $c;
border: 1px solid $d;
&:after {
content: 'Your' + ' ' + $a + ' ' + $b;
color: $d;
}
}
}