2.4 KiB
2.4 KiB
id | title | challengeType | videoUrl |
---|---|---|---|
5b7d72c338cd7e35b63f3e14 | Improve Compatibility with Browser Fallbacks | 0 |
Description
Instructions
.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.
Tests
tests:
- text: Your <code>.red-box</code> rule should include a fallback with the <code>background</code> set to red immediately before the existing <code>background</code> declaration.
testString: assert(code.replace(/\s/g, "").match(/\.red-box{background:(red|#ff0000|#f00|rgb\(255,0,0\)|rgb\(100%,0%,0%\)|hsl\(0,100%,50%\));background:var\(--red-color\);height:200px;width:200px;}/gi));
Challenge Seed
<style>
:root {
--red-color: red;
}
.red-box {
background: var(--red-color);
height: 200px;
width:200px;
}
</style>
<div class="red-box"></div>
Solution
<style>
:root {
--red-color: red;
}
.red-box {
background: red;
background: var(--red-color);
height: 200px;
width:200px;
}
</style>
<div class="red-box"></div>