<random>
A new CSS math function that picks a random value from a range of possibilities. This allows for native CSS randomness without needing JavaScript.
This is an experimental technology. The syntax and behavior are still subject to change.
Syntax
/* Usage Example */
.scatter-item {
/* Pick a random rotation between -10deg and 10deg */
transform: rotate(random(-10deg, 10deg));
/* Each element will get a slightly different random value */
}
<random> Browser support
Limited availability
Since
2020 3% global usage
This feature is not Baseline because it does not work in some of the most widely-used browsers.
26.2+