For a CSS Variable to be inherited by all descendants, it should be defined in the :________ pseudo-class.
- :descendant
- :global
- :inherit
- :root
The correct answer is ":root." When you define a CSS variable in the :root pseudo-class, it becomes a global variable accessible throughout the document, and it is inherited by all descendants. This is commonly used to set global values for colors, fonts, or other properties that need to be consistent across the entire document.
Loading...
Related Quiz
- In a mobile-first approach, media queries are used primarily to add what kind of features for larger screens?
- In a flex container, how does the justify-content property affect the items?
- Which pseudo-class in CSS is used to target elements based on their position in a parent element, like the first child?
- The ________ property in CSS is used to create a linear gradient as the background of an element.
- You have a complex web page layout with nested elements. You want to specifically style an element that is the second child of its parent, regardless of the type of element. Which pseudo-class selector will ensure your style is applied correctly?