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

Chris Scott
Chris Scott
7,673 Points

Advanced SASS Concepts > Interpolation Challenge 4/4 > Bummer! rgb(0, 0, 238)

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.

Error: Bummer! rgb(0, 0, 238)

$time: morning;

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

Double checked and it compiles correctly with no issues in my IDE.

James Barnett
James Barnett
39,199 Points

Tagging Hampton Catlin to get a hint on this one.

Hampton Catlin I am confused about this as well... can you help please? my code looks like this

Guil Hernandez
Guil Hernandez
Treehouse Teacher

Wendell Pulsipher,

Looks like your code didn't post correctly. Take a look at the markdown cheatsheet for instructions on how to post code on the forum.

Ooops.. That's okay. Right after I had posted this comment my browser decided to finish loading the rest of the comments below where I found my problem. Thanks anyways :D

10 Answers

Guil Hernandez
STAFF
Guil Hernandez
Treehouse Teacher

Chris Scott - You're super close. If you nest your if/else statements inside a { ... }, you should be good-to-go. It's all about DRY-ness. :)

Nachiket Kumar
Nachiket Kumar
3,590 Points

I'm having the same issues, I'm getting an error saying: Bummer! The color should be set to red. My code is:

$time: morning
a {
  @if $time == morning {
    color: red;
  }
  @else if $time == afternoon {
    color: blue;
  }
  @else {
    color: gray;
  }
}
Riley Penna
PLUS
Riley Penna
Courses Plus Student 8,511 Points

Has this issue been resolved yet? I am also, getting the same error and I know that the code is right.

Riley Penna You've probably figured it out already, but for future people: If you post if/else block outside of the @mixin by itself, then it passes the code challenge successfully.

Kevin Korte
Kevin Korte
28,149 Points

I come up with the same results as you, and also received the same error. Must be an issue with the server, as I don't see what's wrong. Even double checked the syntax with the video.

Chris Scott
Chris Scott
7,673 Points

The Error is also present when no values are passed to the IF/ELSE

$time: morning;

@if $time == morning { }
  @else if $time == afternoon { }
    @else { }
Hampton Catlin
STAFF
Hampton Catlin
Treehouse Guest Teacher

What version of Sass are you using? You can find this out by typing in sass --version

I tried the above code on Sassmeister.com with 3.3.0rc1 and it works just fine. Check out the gist here: [http://sassmeister.com/gist/7685096]

Chris Scott
Chris Scott
7,673 Points

It compiles fine in my IDE but not on the Code Challenge.

Hampton Catlin
STAFF
Hampton Catlin
Treehouse Guest Teacher

Oh! I didn't actually build the Sass compiler into the Code Challenge module. This is something that sounds like a bug in the code challenge itself. Sorry, I misunderstood!

Let me notify support!

Nachiket Kumar
Nachiket Kumar
3,590 Points

Never mind- silly error. I'll let you figure it out from my code above....there's a missing ; :(

Riley Penna
PLUS
Riley Penna
Courses Plus Student 8,511 Points

Has this issue been resolved yet? I am also, getting the same error and I know that the code is right.