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

Re: [csswg-drafts] [css-values]: Express conditional values in a more terse way (#5009)

From: Jonathan Neal via GitHub <sysbot+gh@w3.org>
Date: Tue, 27 Oct 2020 01:27:52 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-716918072-1603762071-sysbot+gh@w3.org>
> 2\. The one [mentioned by Lea](https://github.com/w3c/csswg-drafts/issues/5009#issuecomment-625545276), which is a [math function](https://drafts.csswg.org/css-values/#math) you provide pairs of calc()-ish comparisons and calc()-ish results, and it resolves to the first value whose comparison succeeds; this can be used anywhere a calc() can. (Just like the other math functions, we can tell what its type will be at parse-time by examining the calculations and grammar-check that accordingly, so it doesn't need to be var-like.)
> ```
> margin-left: cond((50vw < 400px) 2em, (50vw < 800px) 1em, 0px);
> ```

Hey @LeaVerou, in your example, did you intend to reference a quality of the element? I’m unsure at the moment how the above example (`50vw < 400px`) would do this, but in your example (`100% < 50vw`), I’d presumed the `100%` referred to the element width. However, I was talking with @bkardell earlier today, and we realized we didn’t agree on what we thought you meant. 🤷 I think Brian is up to things related to this, and we’d all want the ideas represented as the authors intended them. 😃 

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 27 October 2020 01:27:54 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:21 UTC