<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.

/* 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 */
}
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+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC