Var() with fallback question

Hello, guys! I’m surrounding a problem here with var(). A problem from freecodecamp use this:

in this case, I need use background: var(–penguin-skin, black);
this var is declared in .penguin{ --penguin-skin: black} and I’m using this color black just like a fallback inside .penguin-botton and .penguin-top (that’s no apear in photo), but the answer is wrong.

How do I do to solve this? Somebody help me, please?


Hi @AnnyConfessor your code seems to be correct except in the var() it’s meant to have an incorrect spelling and use the fallback black but you have it spelled correctly as “penguin” you should try misspelling it again as “pengiun”.

1 Like

there seems to be a bug with the test. it requires that you misspell
this code passes:

 background: var(--pengiun-skin, black);

You are correct! @ChrisCline1138 Except it is an intended bug because the point of this lesson is to use fallback values in-case something does go wrong with the former element in the code. So for it to pass it doesn’t matter whether the code is correct considering the first element being --penguin-skin it matters if it uses the fallback value black. (Which can only be used if the first value is wrong)

ah, I see, that makes sense and I see where it went south.

I got your point now, @Myles2. But the problem still there. Think with me, if it was a wrong we were putting there, in that code, why this code doesn’t work with an error diferent of “pengiun”? I tried other erros, like “–penguin-ski, black”, for exemplo, e nothing happened… weird! hahah Btw, thank you so
so much!! You opened my eyes :slight_smile:

thank you so much, @ChrisCline1138!

@AnnyConfessor try resetting the code and starting over maybe you accidentally changed something you aren’t noticing now. What I can see from your picture you posted is that it says
background: var(–penguin-skin, black);
and what I can say for sure is the point of this lesson is to teach that you can use fallback values in-case something goes wrong with the first (former) value so the code for the sake of the lesson should look like this
background: var(–pengiun-skin, black); notice penguin is spelled as pengIUn instead of penguin.

Even if your first value is right which it is you will not pass unless you get the first value wrong so that the second value will run, Why it has to be that specific error message I don’t know maybe it’s the easiest way for them to have their check program to see or they assume you won’t change it since the instructions say not to and you just fix the fallback.

1 Like