Help: Improve Compatibility with Browser Fallbacks Challenge

Blockquote Your .red-box rule should include a fallback with the background set to red immediately before the existing background declaration.

This is what I thought the solution was :

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

I have tried adding in-line styling to the

element, declaring a red background inside the existing .red-box rule and creating another instance of the rule with the background set to red. None of this is the solution. What am I doing wrong here?

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

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

You have to add another background declaration right before the existing declaration.
If you look closely, you’ll see that they have left a gap to do just that:

.red-box {
    //Insert your background declaration here
    background: var(--red-color);
    height: 200px;
    width:200px;
  }
2 Likes

This worked. Thanks for the help.

You’re welcome! :slightly_smiling_face:

What exactly you added? the syntax please.
.red-box {
background: red;
background: var(–red-color, red);
height: 200px;
width:200px;
}
This is not working?