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 trialMUZ140131 Maxwell Maja
10,327 Pointsadvanced sass concepts- creating loops
/* Write your SCSS code below. */
@for $i from 1 through 3
{
.item_#{$i}
{
width: $i * 100px;
}
}
@each $color in red_box, blue_box, green_box {
.color.#{$color} {
background:darken(white,$i)
}
}
<!DOCTYPE html>
<html>
<head>
<title>Sass Basics - Code Challenge</title>
<link rel="stylesheet" type="text/css" href="page-style.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="item_1 red_box"></div>
<div class="item_2 blue_box"></div>
<div class="item_3 green_box"></div>
</body>
</html>
/* Write your SCSS code below. */
@for $i from 1 through 3
{
.item_#{$i}
{
width: $i * 100px;
}
}
@each $color in red_box, blue_box, green_box {
.color.#{$color} {
background:darken(white,$i)
}
}
2 Answers
Sean T. Unwin
28,690 PointsOn Stage 2 of 2 of the Challenge, you need to create an @each
loop for the list of $colors
- 'red', 'blue', and 'green'. Within each iteration of the loop we create a class of .#{color}_box
with a background-color
of $color
.
This information should provide the context to be able to complete the challenge..
If you have any other issues, feel free to ask. :)
ztwbzekpvk
12,893 PointsCan someone post the correct code for both tasks 1 and 2?
MUZ140131 Maxwell Maja
10,327 PointsMUZ140131 Maxwell Maja
10,327 Pointswhere am i going wrong here please help