--- id: 5a9d7286424fe3d0e10cad13 title: Attach a Fallback value to a CSS Variable challengeType: 0 videoUrl: '' localeTitle: 将Fallback值附加到CSS变量 --- ## Description
将变量用作CSS属性值时,如果给定变量无效,则可以附加浏览器将恢复的回退值。 注意:此回退不用于增加浏览器兼容性,并且它不适用于IE浏览器。而是使用它,以便浏览器在无法找到变量时显示颜色。这是你如何做到的:
背景:var( - 企鹅皮,黑色);
如果未设置变量,则会将背景设置为黑色。请注意,这对于调试很有用。
## Instructions
它看起来提供给.penguin-top.penguin-bottom类的变量存在问题。而不是修复拼写错误,将.penguin-top值的black添加到.penguin-top.penguin-bottom类的background属性中。
## Tests
```yml tests: - text: 的后退值应用于blackbackground的财产penguin-top班。 testString: 'assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), "Apply the fallback value of black to the background property of the penguin-top class.");' - text: 将black的后备值应用于penguin-bottom类的background属性。 testString: 'assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi), "Apply the fallback value of black to the background property of the penguin-bottom class.");' ```
## Challenge Seed
```html
```
## Solution
```js // solution required ```