Please help me. I dont understand what I do wrong?

Tell us what’s happening:
I have a problem. What I do false?

Your code so far


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

  background: var(--red-color);
  height: 200px;
  width:200px;
}
</style>
<div class="red-box"></div>
<div class="black-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.80 Safari/537.36.

Challenge: Improve Compatibility with Browser Fallbacks

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

you should change the existing code, not create new one

for your black box, the css is not applying because when you use a class selector you need to put a dot in front of it, so

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

That still is not what this challenge asks you to do:

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

you need to add a second background declaration for the .red-box, without using variables - in this way old browsers that don’t support variables would still be able to make the box red

1 Like

(Nice diff, didn’t know that is possible)

1 Like

Thank you! I understand