Re: [csswg-drafts] [css-values-4] What is the unit of `round(A, B)` if `A` and `B` have different units? (#12690)

You can only resolve `round(2rem, 1px)` at computed value time. And a length is absolutized at computed value time, so the unit doesn't matter.

> Question: what is the expected unit of `round()` if given two different units? Here: 32px since it rounds to the px? Or 2rem (assuming 2rem matches a whole number of pixels)?
> `round(2rem, 1px)`

You seen to assume `1rem = 16px`. In that case,
 - `round(2rem, 1px) = round(32px, 1px) = 32px`
 - `round(2rem, 1px) = round(2rem, 1rem  / 16) = 2rem`
 - And indeed, `32px = 2rem`. Not sure why you think they are different.

BTW, you get zero in Firefox because the value isn't accepted by the parser, so it's not a resolution problem.

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


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

Received on Sunday, 31 August 2025 07:05:09 UTC