Search code examples
csscss-variables

Can CSS variables be rounded with no SASS?


I have a CSS variable which is a calculation of combined other variables, and its value happens to have decimals (147.5px to be precise). I wish I could round this up or down because I don't like decimals.

Is it possible ?


Solution

  • CSS doesn't provide any mathematical functions for rounding a numeric value, whether that value is a custom property value or some other value. calc() does not offer that functionality either.