Re: [csswg-drafts] [css-values] Re-adding min() and max()?

I'll +1 this, I have a `clamp()` helper function I use when building designs sometimes, my JS code for that is pretty simple:

```javascript
function clamp(min, mid, max) {
  return Math.min(Math.max(min, mid), max)
}
```

Example: https://codepen.io/tomhodgins/pen/ALWaVr

After experimenting around with this sort of clamping functionality — where you give a preferred (usually scalable) unit in the middle, capped on either end by a lowest and highest limit — it has been really useful for typography. I'd love to see a `clamp()` function in CSS, especially if it could be used for any value on any property!

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

Received on Friday, 11 August 2017 14:07:35 UTC