How would you provide a fallback value when using a CSS custom property?
- --custom-property: fallback-value, var(--fallback);
- --custom-property: fallback-value;
- --custom-property: var(--fallback, fallback-value);
- --custom-property: var(fallback-value, --fallback);
To provide a fallback value for a CSS custom property, you can use the var() function. The first argument of var() is the custom property, and the second argument is the fallback value. If the custom property is not defined, the browser will use the fallback value. For example, --custom-property: var(--fallback, fallback-value); sets --custom-property to the value of --fallback if it exists, or "fallback-value" if --fallback is not defined.
Loading...
Related Quiz
- If you're experiencing a "flash" of unstyled text on your webpage, it might be related to which aspect of font loading?
- Which value of animation-fill-mode ensures the animation's styles are applied before the animation begins?
- The em unit in CSS is relative to the ________.
- What property is commonly used to control the speed curve of the transition effect?
- In SASS/SCSS, how do you define a mixin?