Re: [csswg-drafts] [css-values-4] inherit() function: like var() for parent value, for any property (#2864)

That's my understanding as well. Moreover, in some of my container query testing, I've noticed that setting up a container produces some wonky and unexpected results to the element that is declared as a container, causing its height to essentially zero out, if not explicitly set.

Being able to inherit those computed values would be a huge win in this case. Most of the times I've set up a container, I've done so specifically to use its width and height, so this seems like it would be easier to reach for in simpler circumstances like this.

**Using container queries**

```css
/* Parent Element */
.parent {
  width: 300px;
  height: 200px;
  container-type: inline-size;
}

/* Child Element */
.child {
  width: 50cqw;
  height: 50cqh;
}
```

**Using inherit()**

```css
/* Parent Element */
.parent {
  width: 300px;
  height: 200px;
  container-type: inline-size;
}

/* Child Element */
.child {
  width: calc(inherit(width) / 2);
  height: calc(inherit(height) / 2);
}
```

---

Also, I understand it would be easier on the first pass of this feature to only support CSS custom properties with the `inherit()` function, but in 99% of cases, can't CSS custom properties be naturally inherited without using `inherit()`, except when a CSS custom property is set to `inherits: false` using `@property`?

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


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

Received on Friday, 29 December 2023 16:14:51 UTC