How to do the basic CSS

Tell us what’s happening:
I don’t know how to do the “Basic CSS: Improve Compatibility with Browser Fallbacks”

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

Challenge: Improve Compatibility with Browser Fallbacks

Link to the challenge:

let’s consider these things:

  • if a browser doesn’t understand a value for a css rule, it will ignore the rule.
  • so if a browser doesn’t support css variables it will ignore the rule for the background
  • if it ignores the rule, it will see if above it there is an other rule that can be used instead of it
  • so if we add a background rule just above the existing one the browser will use that one, if it can
  • it will use it if the new background rule do not use css variables.

you are right but how a have to write thaat background fallback