Improve Browser Fallbacks

Improve Browser Fallbacks
0

Tell us what’s happening:

Your code so far


<style>
  :root {
    --red-color: red;
  }
  .red-box {
    
    background: var(--red-color,red);
    height: 200px;
    width:200px;
  }
</style>
<div class="red-box"></div>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/basic-css/improve-compatibility-with-browser-fallbacks/

How would you add a rule for the background without knowing about variables? That’s what a browser that doesn’t support variables need

Don’t change the existing rule, that could make the tests not pass

did’t get what is this

I don’t get what you don’t get

Imagine you have never heard about variables, how do you set a background to red? that’s what this challenge wants from you and what browsers that don’t support variables need

i am still stuck in this topic ,
what is coding of this please tell me

I will not tell you the answer

Have you tried something? show me what you have tried

:root { --red-color: red; --black-color:black; } .red-box { background: var(--red-color,red); height: 200px; width:200px;}

Reset your code.

Now right above this line:
background: var(--red-color);

Set the background to red the way you would normally do it.

  .red-box {
    /* Set the background to red here */

    background: var(--red-color);
    height: 200px;
    width:200px;
  }

you don’t need to create a new variable - you have to add a background declaration that doesn’t use variables

1 Like

Thank you so much sir