[css-values-5] Feedback on `<size-keyword>` for `calc-size()`
css-values-5Closed as Question Answered
[`<size-keyword>`](https://drafts.csswg.org/css-values-5/#typedef-calc-size-size-keyword) has recently been [updated](https://github.com/w3c/csswg-drafts/commit/8c67ba03f553e5697424ac13a5d3f3188bc82bf2) to accept sizing *functions* like `fit-content()`, in addition to sizing *keywords*.
It seems that `<size-keyword>` basically accepts all values allowed in the context, with the exception of `<length-percentage [0,∞]>`.
**[`width`](https://drafts.csswg.org/css-sizing-3/#propdef-width), `height`, `min-width`, `min-height`**
`auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()>`
**[`max-width`](https://drafts.csswg.org/css-sizing-3/#propdef-max-width), `max-height`**
`none | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()>`
So I wonder if all values allowed in the context cannot simply be allowed, since `<calc-size-basis>` also accepts `<calc-sum>`, which accepts `<length-percentage [0,∞]>`. If so, `<size-keyword>` could be replaced with `<size-value>`, or `<'width'>` if `none` must not be allowed, which is not very clear.
*Edit:* I realized that `<anchor-size()>` is also allowed in the context (as an extension to the productions above), which is probably the reason why `<size-keyword>` exists.
关闭于 2026-07-24 1 条评论