Re: [csswg-drafts] [css-values] Add round()/floor()/ceil() functions (#2513)

I think such a function should accept `<number>`s or `<dimension>`s, but only be valid when the value and the precision have the same type. The most reasonable default for an omitted precision parameter would be `1`. Then you can use `round(2.4)` but not `round(2.4px)`.

At first glance it can seem that a `1px` precision would be good for `round(2.4px)`, but would people still expect `1px` for `round(2.4cm)`, or would they expect `1cm`? What about `round(2.4cm + 3.5lh)` or `round(2.4deg + 3.5rad)`?

To avoid confusion, for dimensions I think it's better to require the precision like `round(2.4px, 1px)`. Authors could also do the math with numbers and add the unit at the end: `calc(round(2.4) * 1px)`

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

Received on Friday, 13 December 2019 12:34:04 UTC