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 Creating Loops with @for and @each

Having trouble with the Challenge Task in Sass

Hey,

I'm having trouble with the passing the Challenge Task with the For loops. The Question is...

Make a @for loop to iterate through the numbers 1 through 3. The for loop should create classes named in the format "item_#{$i}" and set the width to be $i * 100px.

@for $i from 1 through 3{
  item_#{$i};
  width:$1 * 100px;

}

1 Answer

Tess Griffin
Tess Griffin
7,113 Points

It looks like you're not actually creating classes in your loop. You need to have @for $i from 1 through 3{ .item_#{$i} { width: $i * 100px; } } You also need to have the variable $i when in your width statement. Right now you have $1 which isn't your variable.