DEV Community

Discussion on: CSS Variables

 
frontendprof profile image
AbdulMalik

Thank you for the reply.
But I was implying explanation of your nested calc function. It would be great if you could elaborate on that one as well please, if you don't mind of course.

Thread Thread
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

developer.mozilla.org/en-US/docs/W...

CSS calc 'calculate' is built into CSS and can be nested, the full documention can be found above.

However nesting refers to the fact that calc exaluates to a unit so then calc(calc(2px + 4px) + 4px)

10 pixels

But this is particularly useful for complex math with variables because variables can change in media query and stateful circumstances (:hover, :focus etc)

Thread Thread
 
frontendprof profile image
AbdulMalik

thanx