Re: [csswg-drafts] [css-values-5] Names of the random-name keywords (#13601)

> The `<random-cache-key>` argument is required in `random-item()`, but optional in `random()`, for parsing reasons

🙄 That is a lame excuse for bad design. `nth-item(random(), ...)` (or similar) would not have that problem. 

I’m still unconvinced that the random key caching strategy belongs inside the function in value space. If you don’t like `random(--key)` without limits, because it’s too much like `var(--key)`, just use that then:

~~~~
@random --foo from 1px to 100px per element;
/* or */
@property <length> --foo random(1px, 100px) per element;
/* or */
@property --foo {
  syntax: <length>;
  initial-value: random(1px, 100px);
  key-cache: element;
}
/* or similar */

.random-square {
  width: var(--foo);
  height: var(--foo);
}
~~~~

Leave `random()` to values as random as possible.


-- 
GitHub Notification of comment by Crissov
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13601#issuecomment-4012749930 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 6 March 2026 16:33:13 UTC