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

Re: [csswg-drafts] [css-values] if() function (#3455)

From: Matthew Dean via GitHub <sysbot+gh@w3.org>
Date: Thu, 20 Dec 2018 23:43:33 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-449178158-1545349412-sysbot+gh@w3.org>
@tabatkins 

> So, unfortunately, we've had to reject ideas like this in the past, and as far as I can tell, there's nothing mitigating the problems in this proposal either. Sorry. :(

That's alright! And I would assume you would know the engineering challenges better than I would. I have to do the same rejections for Less when it's just not feasible with how statements/functions/vars are evaluated. I didn't have high expectations for `if()` natively but thought I would ask.

Has there ever been a proposal / consideration of being able to define units, or capture values at a certain stage? That would maybe take CSS authors halfway.

As in (this syntax is terrible, just illustrating the concept): 
```css
.grandparent {
  width: 200px;
  height: 200px;
}
.parent {
  @unit --foo 100ch;  /* container height at this point, i.e. 200px */
  width: 1px;
  height: 1px;
  position: absolute;
}
.grandparent .parent .child {
  position: absolute;
  width: calc(100--foo);  // use an inherited unit value 
}
```
That is, if there was a way to query the cascade, or mark values (declared or inherited) in the cascade with vars to consume later, it would provide a lot of dynamism without logic switches.

-- 
GitHub Notification of comment by matthew-dean
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3455#issuecomment-449178158 using your GitHub account
Received on Thursday, 20 December 2018 23:43:39 UTC

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