--- id: 5a9d727a424fe3d0e10cad12 title: Use a custom CSS Variable challengeType: 0 videoUrl: 'https://scrimba.com/c/cM989ck' --- ## Description
After you create your variable, you can assign its value to other CSS properties by referencing the name you gave it. ```css background: var(--penguin-skin); ``` This will change the background of whatever element you are targeting to gray because that is the value of the --penguin-skin variable. Note that styles will not be applied unless the variable names are an exact match.
## Instructions
Apply the --penguin-skin variable to the background property of the penguin-top, penguin-bottom, right-hand and left-hand classes.
## Tests
```yml tests: - text: Apply the --penguin-skin variable to the background property of the penguin-top class. testString: assert(code.match(/.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi), 'Apply the --penguin-skin variable to the background property of the penguin-top class.'); - text: Apply the --penguin-skin variable to the background property of the penguin-bottom class. testString: assert(code.match(/.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.right-hand\s{/gi), 'Apply the --penguin-skin variable to the background property of the penguin-bottom class.'); - text: Apply the --penguin-skin variable to the background property of the right-hand class. testString: assert(code.match(/.right-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}[\s\S]*.left-hand\s{/gi), 'Apply the --penguin-skin variable to the background property of the right-hand class.'); - text: Apply the --penguin-skin variable to the background property of the left-hand class. testString: assert(code.match(/.left-hand\s*?{[\s\S]*background\s*?:\s*?var\s*?\(\s*?--penguin-skin\s*?\)\s*?;[\s\S]*}/gi), 'Apply the --penguin-skin variable to the background property of the left-hand class.'); ```
## Challenge Seed
```html
```
## Solution
```js var code = ".penguin-top {background: var(--penguin-skin);} .penguin-bottom {background: var(--penguin-skin);} .right-hand {background: var(--penguin-skin);} .left-hand {background: var(--penguin-skin);}" ```