How to add a background declaration and set to red just before the existing declaration

Tell us what’s happening:
how to add a background declaration and set to red just before the existing declaration.

Your code so far


<style>
  :root {
    --red-color: red;
  }
  .red-box {
    background: var(--red-color, red)
    background: var(--red-color);
    height: 200px;
    width:200px;
  }
</style>
<div class="red-box"></div>

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 10895.56.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.95 Safari/537.36.

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

Have you tried just red; after the background statement?

1 Like

yes i’ve tried it, but it did not work

Thanks, i’ve seen the cause it was i who made a mistake i forgot to add my semicolon after the red.

how did you sort it out ? im also stuck.

set your background to red only just before the existing background and add semicolon.

1 Like

still doesnt work.

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

what i mean is background: red; before the existing background

1 Like

:root {

–red-color: red;

}

.red-box {

background: red;

background: var(–red-color);

height: 200px;

width:200px;

}

It works for me.

Thanks

2 Likes

thx it’s work with me 3>

This worked for me as well. Thanks for sharing!

just do like this and you will be passed.

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