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!
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
brandon snyder
2,314 Pointscompilation error
I keep getting an error with this, and have no idea why:
$time: morning;
{ @if $time == morning { color: red; } @else if $time == afternoon { color: blue; } @else { color: gray; }
}
a (color:$time;)
1 Answer

Jason Anello
Courses Plus Student 94,610 PointsHi Brandon,
I think your only mistake is that you didn't nest your if/else directives within the a
rule.
$time: morning;
a {
@if $time == morning {
color: red;
}
@else if $time == afternoon {
color: blue;
}
@else {
color: gray;
}
}