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

Julian Tung
Julian Tung
6,282 Points

Advanced Sass Interpolating and If/Else

Hi there, first time posting on the forums so forgive me if I make any formatting mistakes etc.

I am currently having trouble with Challenge task 2/4 for this section:

The mixin should use the value in "$make" as the name of a new class. The class should have a 1px solid black border.

Here is what I have so far -

@mixin cars($make, $color) { }

I am assuming I've already made a mistake starting off like this as there is no interpolation currently (.#)

6 Answers

Yichang Liu
Yichang Liu
4,688 Points

the class should be: .#{$make}

@mixin cars($make, $color){
    .#{$make}{
    border: 1px solid black;
  }
}

@mixin cars($make, $color){ .#{$make}{ border: 1px solid black; .append {background-image:url("#{$color}.png");} } }

the next bit ;)

Julian Tung
Julian Tung
6,282 Points

Thank you for your help Yichang, worked perfect!

@mixin cars($make, $color){ .#{$make}{ border: 1px solid black; .append {background-image:url("#{$color}.png");} } }

the next bit ;)

@mixin cars ($make , $color){ .#{$make} { border: 1px solid black; } }

@mixin cars ($make ,$color){ .#{$make} { border: 1px solid black; .append { background-image: url("images/.#{$color}.png")} } }