W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2020

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

From: Bramus! via GitHub <sysbot+gh@w3.org>
Date: Sat, 26 Dec 2020 22:17:47 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-751401679-1609021066-sysbot+gh@w3.org>
@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

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:37 UTC