How do I set the fallback background?

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

<style>
:root {
  --red-color: #FF0000;
}
.red-box {
background: red
  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/97.0.4692.71 Safari/537.36

Challenge: Improve Compatibility with Browser Fallbacks

Link to the challenge:

One should always end a property: value; pair with a semi-colon

Do you mean how do you set the fallback value if the variable does not work?
The syntax would be

background: var(–red-color, red);

The lesson on this is here: https://www.freecodecamp.org/learn/responsive-web-design/basic-css/use-css-variables-to-change-several-elements-at-once

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.