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

The only reason I want to use `parent(..)` is to *avoid* the hack of assigning to a custom prop just so its value can be inherited/accessed by a child. I've already been doing that a lot for a few years. It works, but its definitely more boilerplate'y.

So if the `parent(..)` pattern in practice still requires that as soon as you need to go more than one level up, I'd say it's probably not going to help my use-cases nearly as much. If I have to use custom-props for this inheritance access in some or many of my uses, I'll probably stick to that same technique in all of them, for consistency.

`parent(..)` would in effect just be a special case of the custom-props technique, rather than a clearly more declarative alternative. Using it alongside custom props doing "the same thing" but up further than one level, that seems like it would make code less clear rather than better.

I'd urge some non-custom-prop way of "chaining" access... perhaps something like this:

```css
.foo {
   width: 100px;
}

.foo > .bar {
   width: calc( parent(width) * 0.5 );
}

.foo > .bar > .baz {
   width: calc( parent(parent(width)) * 0.2 );
}
```

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


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

Received on Monday, 12 April 2021 12:23:39 UTC