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

Sass Challenge question 4 - error says "The color should be set to red"

When i tested my challenge on my sublime text editor it did set the color to red, and no errors, i use Sass compiler and my main.scss and my main.css did great.

------------------------------------------------------------------------------------
my main.scss input:
-----------------------------------------------------------------------------------

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

            a {

            @if $time == morning {
                color: red;
                } @else if $time == afternoon {
                color: blue;
                } @else  { 
                color: gray; }

            }   

    }                           
}

@include cars (morning, blue)
-----------------------------------------------------------------------
My main.css output:
------------------------------------------------------------------------------
.morning {
  border: 1px solid black;
  background-image: url("images/blue.png"); }
  .morning a {
    color: red; }

2 Answers

Hi Errin,

Task 4 is completely separate from the first 3. It looks like you've tried to include the if/else directives inside your cars mixin. You should close off your mixin before $time: morning;

Let me know if you're still getting stuck.

Fixed! :) thank you!

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

/* ------ Input: main.scss Ouput: main.css------------------------- */ a { color: red; }

You're welcome!