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 trialWayne Priestley
19,579 PointsSass challenge troubles
Hi all,
I'm stuck and would appreciate some help please.
Ive been on this stage of the challenge for so long i don't think i could solve it if the answer were looking right at me.
Q.
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 tray.
My code is as follows,
@mixin cars($make, $color);{
.#{$make}{
border: 1px solid black;
.#{$color}
background-image: url("images/#{$color}.png");
}
}
$time: morning;
a {
@if $time == morning { {color: red;}
@else if $time == afternoon { {color: blue;}
@else {color: gray;}
}
}
}
I have had the 'a' tag all over the place, i don't think it is in the right place now either but I've had it everywhere else apart from the correct place of course.
here is the challenge 4 of 4
Thanks
6 Answers
Paul Graham
1,396 Pointswell one syntax problem I see off top is that you have a semicolon in the first line which should be removed
Kevin Korte
28,149 PointsPaul found one issue you have incorrect.
Also, when you are using interpolation to create the url for the background-image, re-read how they told you to structure the URL. They said nothing about an images folder, but you added that. So there is a fail point.
Also, your @if statement.
Review the syntax here: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#_6
You have too many curly brackets going on. Clean those up and you will pass.
Jeremy Stewart
19,676 PointsIm having the same issue here is my code
$time: morning; a { @if $time == morning { color: red; } @else if $time == afternoon { color: blue; } @else { color: gray; } }
Wayne Priestley
19,579 PointsJeremy, what error msg are you getting?
Wayne Priestley
19,579 PointsThanks Paul.
Hi Kevin,
The challenge containing the url question has passed, i guess i got lucky there then :)
I've cleaned up my code to this.
$time: morning;
a {
@if $time == morning {
color: red;
}
@else if $time == afternoon {
color: blue;
}
@else {
color: gray;
}
}
But I'm getting time out errors on the challenge, when it does not time out I'm getting.
Bummer! The color should be set to red.
Kevin Korte
28,149 PointsWeird on the background URL, I passed with just #{$color}.png
. Usually the thing is so picky.
I do see after you set your time variable you forgot the semicolor.
Wayne Priestley
19,579 PointsI thought you and Paul said that was one of my mistakes, having a semicolon?
well one syntax problem I see off top is that you have a semicolon in the first line which should be removed
Even though on Sass reference it includes a semicolon.
Anyway its still the same bummer msg with or without it :(
Paul Graham
1,396 PointsThe semicolon i was talking about is after your mixin declaration.
Kevin Korte
28,149 PointsPaul was talking about the semicolon on this line
@mixin cars($make, $color);{
That is the one that needs to be removed.
Wayne Priestley
19,579 PointsOh I see, sorry. That passed too
Jeremy Stewart
19,676 PointsBummer! The color should be set to red.
Wayne Priestley
19,579 PointsI have a feeling that if i leave it and return tomorrow it will pass first time.
It wouldn't be the first time thats happened.
Wayne Priestley
19,579 PointsSolved, thanks to Guil.
Turns out that i needed to remove the $color that i had entered below border style in my previous code.
Wayne Priestley
19,579 PointsWayne Priestley
19,579 PointsI need to add, This is my error msg….. Bummer! The color should be set to red.