Improve Compatibility with Browser Fallbacks aisha

Improve Compatibility with Browser Fallbacks aisha
0

Tell us what’s happening:

html.css

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

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

So this challenge mentions how the IE browser can’t use CSS variables. So you’d have to explicitly declare the background: red property like you normally would.

What the challenge tells you is “…imagine that background: var(--red-color); goes kaboom on Internet Explorer…” if that is the case it will ignore that background: var(--red-color); so it will try to find another background hopefully, without variables.

So what you have to do is to add that fallback (the background without variables meaning background: red just above the variable background).

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