You have a CSS variable named --gap, and you want to double its value and use it as a margin. How would you achieve this using CSS functions?
- margin: calc(--gap * 2);
- margin: calc(var(--gap) * 2);
- margin: var(--gap * 2);
- margin: var(--gap * 2);
To double the value of a CSS variable named --gap and use it as a margin, you should use the calc() function within the margin property. The correct option is margin: calc(var(--gap) * 2);, which properly references and doubles the variable value.
Loading...
Related Quiz
- If a custom web font isn't supported or doesn't load, the browser will default to a ________ font.
- Which CSS property defines the number of times an animation should run?
- Which CSS unit is relative to the root element's font size?
- If you want an animation to alternate between running forwards and backwards, you would use the animation-direction value of ______.
- While using a CSS preprocessor, you notice that the compiled CSS has selectors that are excessively long and specific. What might be a potential cause for this in your source files?