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

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

#1

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


#2

Have you tried just red; after the background statement?


#3

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


#4

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


#5

how did you sort it out ? im also stuck.


#6

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


#7

still doesnt work.

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

#8

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


#9

:root {

–red-color: red;

}

.red-box {

background: red;

background: var(–red-color);

height: 200px;

width:200px;

}

It works for me.

Thanks