--- id: 5a9d7295424fe3d0e10cad14 title: Inherit CSS Variables challengeType: 0 videoUrl: 'https://scrimba.com/c/cyLZZhZ' forumTopicId: 301088 dashedName: inherit-css-variables --- # --description-- When you create a variable, it is available for you to use inside the selector in which you create it. It also is available in any of that selector's descendants. This happens because CSS variables are inherited, just like ordinary properties. To make use of inheritance, CSS variables are often defined in the :root element. `:root` is a pseudo-class selector that matches the root element of the document, usually the `html` element. By creating your variables in `:root`, they will be available globally and can be accessed from any other selector in the style sheet. # --instructions-- Define a variable named `--penguin-belly` in the `:root` selector and give it the value of `pink`. You can then see that the variable is inherited and that all the child elements which use it get pink backgrounds. # --hints-- The `--penguin-belly` variable should be declared in the `:root` and assigned the value `pink`. ```js assert( code.match(/:root\s*?{[\s\S]*--penguin-belly\s*?:\s*?pink\s*?;[\s\S]*}/gi) ); ``` # --seed-- ## --seed-contents-- ```html