Improve Compatibility with Browser Fallbacks.,

Improve Compatibility with Browser Fallbacks.,
0
#1

Tell us what’s happening:
can someone explain?

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 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

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

#2

This means that if you do want to provide a browser fallback, it’s as easy as providing another more widely supported value immediately before your declaration.

#3

Not all browsers support variables (https://www.w3schools.com/css/css3_variables.asp). So you need to make sure there’s a fallback for the browsers that don’t understand variables. How would you make a red background without a variable?

#4

you just need to add
background: red;
before
background: var(–red-color);

This is only need to add because if browser can not recognize the variable i.e." background: var(–red-color);“than browser set to the main style i.e.” background: red;"

2 Likes
#5

It is not accepting this.

#6

@karemahm have you finally gotten it cos i have not still gotten it