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

Brad Lacke
Brad Lacke
7,438 Points

When does Sass require #{} ?

I'm a little confused about when it's OK to use $variable and when Sass requires us to use #{$variable} instead. I get that if we want a variable in the property, it's required, but it also seems that in some of these videos, #{$variable} needs to be in the value as well. Is there an easy way to predict which it will be?

2 Answers

cesarruelas
cesarruelas
27,718 Points

You use #{} whenever you will use interpolation in Sass. Check out this site to learn about what interpolation does.

Brad Lacke
Brad Lacke
7,438 Points

Thanks cesar! That helps