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 Interpolating and if/else

Not sure about this. I need some help, please.

I'm not entirely sure where my error is for this challenge. I'm on part four and part four says: "Underneath the previous code, store the value "morning" in a variable named $time. Then write an if/else directive that will color all <a> tags. If the variable $time is equal to "morning", the color should be red. Otherwise, if the variable is "afternoon", the color should be blue. Finally, if the variable is set to anything else, the color should be gray."

When I check my work it says "Bummer! The color should be set to red."

Here is my code:

@mixin cars($make, $color) { .#{$make} { border: 1px solid black; background-image: url("#{$color}.png") } $time: morning; a{ @if $time == morning {$color:red;} @else if $time == afternoon {$color:blue;} @else {$color:gray;} } }

Figured it out.

3 Answers

Paulo Aguiar
Paulo Aguiar
14,120 Points

the time is a string, so wrap them in quotes.

any text that is stored in some type of variable is wrapped in quotes

I'm sorry "them"?

I'm sorry "them"?