---
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: 的后退值应用于black
为background
的财产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
## Solution
```js
// solution required
```