Improve Compatibility with Browser Fallbacks (HELP)

Tell us what’s happening:
What to do?

Tried these things but non of them are working:-

i) Adding background with red.

      .red-box {
    background: red;
    background: var(--red-color);
    height: 200px;
    width:200px;
  }
//this is not working.

ii) Adding callback as told in the previous lesson just before this.

  .red-box {
    
    background: var(--red-color, red);
    height: 200px;
    width:200px;
  }
//this is also not working.

The console shows this as an output.

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

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/75.0.3770.142 Safari/537.36.

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

The first CSS you have should work. Try resetting and enter the code again.

1 Like

Your first solution should work. What browser are you using and what version is it?

Google Chrome Version 76.0.3809.87 (Official Build) (64-bit)
It worked after refreshing the whole page.
THANK YOU