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

Jon Brady
Jon Brady
10,868 Points

Advanced Sass Concepts (Stage 4) HELP Please

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. Else, if the variable is "afternoon", the color should be blue. Finally, if the variable is set to anything else, the color should be gray.

What am i doing wrong...(so confused)

Error: Bummer! The color should be set to Red.

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

6 Answers

Wayne Priestley
Wayne Priestley
19,579 Points

OK Jon Ive got it, the problem isn't with your last piece of code its with the code that precedes it. your missing some curly brackets in the mixin, not sure how it passed without them, here is what it should look like.

@mixin cars ($make, $color){ 
@include make { 
.#{$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: grey;
  }
}
Wayne Priestley
Wayne Priestley
19,579 Points

Sorry this may be no help but your code is correct as far as i can see Jon.

can you give a link to the challenge please, ill enter your code and see if i get the same error.

Jon Brady
Jon Brady
10,868 Points

like i said its the fourth question in dont think theres a way to go straight to the question so heres the answers to the questions before

@mixin cars ($make, $color);
@include make {
    .#{$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;
    }
  }

id really appreciate any help here as iv spent all day on it so far.

Wayne Priestley
Wayne Priestley
19,579 Points

Sorry for the delay Jon, just having lunch.

Your code is 100% right, that I'm sure of.

I think this may be a glitch in the challenge, this isn't uncommon, I suggest you email support, fine them all the info you can including your code.

I'm going to try again soon, i'll get back to you.

Jon Brady
Jon Brady
10,868 Points

Thank you so much you saved my sanity:)