Tell us what’s happening:
Your code so far
<style>
:root {
--red-color: red;
}
.red-box { red
background: "red" var(--red-color);
height: 200px;
width:200px;
}
</style>
<div class="red-box"
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
.
Challenge: Improve Compatibility with Browser Fallbacks
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
1 Like
Hello @samyprince . The challenge is telling you to add a background
property with the value of red
right before the existing background
property. But, what you did instead is that you added "red"
right before the var
.
This challenge is for increasing the browser compatibility if you use varaibles in CSS. For example, a browser which does not support variables won’t show any background colors. To tackle this, adding another background
property after the variable fixes the problem.
background: red; // this is for uncompatible browsers
background: var(--red-color); // this is for modern browsers.
Hope this helps!
am meant to include a fallback with the background set to red immediately before the existing background declaration pls tell me where to put it
1 Like
You should add another background
property before the existing background
property.
nibble
October 24, 2020, 2:38pm
8
@samyprince Can you copy and paste the code you are submitting here.
Hey @samyprince , you have an extra red here:
samyprince:
.red-box { red
<–this!
nibble
October 24, 2020, 2:59pm
12
This is how you post code @samyprince
``
<style>
:root {
--red-color: red;
}
.red-box {
background: red;
background: var(--red-color);
height: 200px;
width:200px;
}
</style>
<div class="red-box"
1 Like
Or background-color: red;
with an indention!
Hey @samyprince . Seems like you solved the problem yourself. Congrats!
Tell us what’s happening:
Your code so far
<style>
:root {
--red-color: red;
}
.red-box {
background: red;
background: var (--red-color);
height: 200px;
width:200px;
}
</style>
<div class="red-box"
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
.
Challenge: Improve Compatibility with Browser Fallbacks
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
nibble
October 24, 2020, 3:08pm
18
Change the last line of code to <div class="red-box"> </div>
. And please stop creating duplicate topics.