Improve Compatibility with Browser Fallbacks Please help!

Tell us what’s happening:

Your code so far


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

I want to create a Browser fallbacks to create a background, red in colour. But can’t find the way to create it…
Check this out and reply with the required solution…

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36.

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

On top of the provided background property that uses var() is where you’ll provide the fallback:

.red-box {
  background: red;
  background: var(--red-color);
}

Given how CSS works, a browser will try to use the second background property. But if a browser doesn’t support CSS variables, it will not understand the second background property and ignore it, but will use the first one.

1 Like