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 Interpolation Question

HI there! I'm learning about Sass interpolation and if/else statements. I'm not sure why, but the code engine is giving me an error message that says the background-image url doesn't end with '.png'. The funny thing is, it was correct in the previous challenge, but once I wrote the @if statement it showed me that error. I was wondering if anyone else has experienced this or can see the solution? Thanks so much for any help!

style.scss
/* Write your SCSS code below. */
@mixin cars ($make, $color){
  .#{$make}{
  border: 1px solid black;
  background-image: url("#{$color}.png");
  }
}

$time: "morning";

@if ($time == "morning"){
color: red;
} @else if ($time == "afternoon") {
color: blue;
} @else {
color: gray;
}
Ken Alger
Ken Alger
Treehouse Teacher

Andrew;

What is(are) your question(s)?

Ken

Sorry, I edited the post and accidentally erased my question. Should be normal now :)

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Andrew;

A couple of things.

First, you are not targeting any elements with your @if statement.

Second, your syntax for your @if statements are not quite correct.

Third, $time: morning;, not $time: "morning";.

Remember the task is asking that you target the a tags.

Hope it helps and post back with other questions.

Ken

Great, thanks! Yeah I guess reading the directions would help a little. I'll try it out a couple more times and fix my syntax.

Thank you so much! I guess I just didn't watch that video as intensely as I should have. Much obliged.