Re: [csswg-drafts] [css-variables?] Higher level custom properties that control multiple declarations (#5624)

@isiahmeadows The one in #3455 allowed checks on _"any value"_ …

> [W]hat's useful about `if()` is that […] you can use it for any value.

… which was the reason for closing it.

> This is, unfortunately, what makes this so much harder, and probably not capable of happening […]

If it the proposed `if()` function were to be limited to only check a Custom Property against a certain value, then it'd be possible I guess?

```css
/* Valid: Custom Properties */
width: if(var(--size) = big, 10em, 2em);
gap: if(var(--numchildren) > 10, 4em, 2em);

/* Invalid: Non-Custom Properties or other values */
padding: if(width > 10em, 2em, 1em);
width: if(1em < 5%, 400px, 600px);
```

That would immediately also solve the “Partial application” issue @LeaVerou [mentions](https://github.com/w3c/csswg-drafts/issues/5624#issuecomment-746339609), as it simply wouldn't be allowed.

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


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

Received on Saturday, 26 December 2020 22:17:48 UTC