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

Can you please help me with this code challenge?

I am in need of assistance in this code challenge.

http://teamtreehouse.com/library/sass-basics/advanced-sass-concepts/creating-loops-with-for-and-each-2

Here is my code.

@for $i from 1 through 3 {
  (item_#{$i} {
    width: $i * 100px;
  }
}
Ken Alger
Ken Alger
Treehouse Teacher

Edited for markup.

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Leon;

One small typo and I think you have it. The task is asking to create classes, which is signified by a period, . in CSS. Your code right now has an opening parenthesis ( where the period should be.

/* Write your SCSS code below. */

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

Other than that, great job working through the challenge!

One suggestion I would have, if you have not tried it yet, is that when working through the challenges try the challenge code in the Sassmeister.com site. I found it to be very helpful when doing things like @for to see how Sass gets translated into CSS and where my coding errors are.

Ken