[css-values] Add clamp()? · Issue #2519 · w3c/csswg-drafts (original) (raw)

For background, see discussions starting at #544 (comment)


It would be useful to add a clamp() function. Two kinds of argument order were proposed in #544:

Both of them have precedents[1][2]. (I personally prefer the (min, value, max) version.)

Although authors can emulate it by combining max() and min(), the clamp() function can avoid the confusion caused by the emulation.

The behavior of clamp() on <angle> and <color> also needs some thoughts.


Links:

[1] clamp in the Boost Algorithm Library
[2] qBound in Qt