Varibale being used to set the background color

Tell us what’s happening:
It looks like a variable is being used to set the background color of the .red-box class. Let’s improve our browser compatibility by adding another background declaration right before the existing declaration and set its value to red .
Your code so far


<style>
:root {
  --black-color: black;
}
.black-box {
  background: black;  /* this is the browser fallback */
  background: var(--black-color);
  width: 100px;
  height: 100px;
  }
: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/89.0.4389.90 Safari/537.36.

Challenge: Improve Compatibility with Browser Fallbacks

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

The more information you give us, the more likely we are to be able to help.

Not sure why you added the CSS for the color black and created the new class selector for it?

You are supposed to use the CSS already in the code and just add background: red; to the .red-box (like you did for the .black-box selector).

1 Like

Thanks for that but, I have done that but it’s not coming up

Your code passes for me when I add background: red to the .red-box selector.


We need to see your new code:

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).


Also, make sure you do not have any dark mode/dark reader browser extensions running as they will mess with the CSS.

1 Like

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