Re: [csswg-drafts] [css-values-5] The `<random-value-sharing>` options for `random()` are confusing (#13132)

Okay, I was looking at this again to see about making a version of my image (above) with @bramus 's suggested keywords, and I realized I was interpreting them the opposite way of what Bramus was suggesting. ^_^ (I was reading `random(... per-property, ...)` as meaning "random per property", rather than "cached per property".)

I definitely understand *why* people are thinking that `random(--foo, ...)` is globally keying to the `--foo` (aka maximum shared; everything with `--foo` shares the same random base value); that's a totally reasonable assumption to make. If we do go with that as the actual behavior, then, we need the keywords to pull it back to the "partially shared" behavior.

I wonder if preserving the "shared" term will reduce confusion if it's used for *both* axises, then. That would produce a grammar of:

```
random( [ <<dashed-ident>> || element-shared || property-shared ], ...)
```

* omitting all of them gives you "max randomness", as today: the caching key uses an element ID and a property+usage ID to force things to not share.
* Using `element-shared` and/or `property-shared` either shares between elements or between properties, by setting the element ID or the property+usage ID to null. You can use a dashed-ident to subdivide the shared values into groups.
* Using both keywords gives you maximal sharing; everything on the entire page will use the same random base value. Using *just* a dashed-ident also does so, subdividing the shared values into groups.

Modifying my image above to use this suggestion:

<img width="1246" height="726" alt="Image" src="https://github.com/user-attachments/assets/e0b90b08-7f28-4d3a-ba40-e296390e9967" />

What do you think? @bramus ?

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


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

Received on Wednesday, 4 February 2026 00:24:07 UTC