Re: [csswg-drafts] [css-color-5] Allow use of 0 with <percentage> color components (#7338)

> Yeah, we absolutely cannot allow unitless percentages in general; `width: 0%` has very different behavior from `width: 0px` when the container has indefinite available width.

I wasn't aware of that. So yeah, then we can't generalize unitless percentages.

> I'd rather just relax the grammar to allow _any_ mixture of numbers and %s across the arguments.

> So there is an assumed Web compat issue (what content does, what scripts expect, what browsers implement since forever), although given other changes like the 0..255 form now allowing <number>, removal of commas, and addition of none it isn't clear that this is a strong argument.

I'd be fine to relax the syntax to allow mixtures of numbers and percentages to cover the described use case (even when it looks a bit weird to me mixing numbers besides 0 with percentages).

@svgeesus As you say, there were already a lot of other more desruptive changes to the syntax. So I don't think that's a big issue. But maybe someone could make an HTTP archive query to check whether there are currently usages of number and percentage mixtures (that currently break but would work after that change and cause a visual difference).

At least tools like VS Code obviously already support mixing numbers and percentages. And SCSS and PostCSS just pass them through without errors.
So the Web ecosystem seems to be already prepared for that. And if there are tools that don't allow mixing both, they can adjust easily.

Sebastian

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


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

Received on Saturday, 18 June 2022 21:22:05 UTC