Created
February 3, 2022 14:31
-
-
Save yairEO/40ffc785db4bf82a7068dfcbc6a7ad80 to your computer and use it in GitHub Desktop.
CSS math
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***** ceil ******/ | |
/* For a value between 0 - 1, where 1 is the maximum possible */ | |
--ceil: clamp(0, calc((1 - var(--value)) * 100), 1); | |
/***** floor ******/ | |
/* For a value between 0 - 1, where 1 is the maximum possible, use a value just a tiny bit below the maximum for the | |
math to work, so the output will be either positive or negative when magnified by a factor of 999999*/ | |
--floor: clamp(0, calc((var(--value) - 0.99999) * 999999), 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment