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

This is currently a hack because you need something like

```css
.foo { /* the actual value has to be set to a custom prop :( */
  --width: 100px;
  width: var(--width);
}
.foo > .bar {
   width: calc( var(--width) * 0.5 );
}
.foo > .bar > .baz {
   width: calc( var(--width) * 0.2 );
}
```

With parent(), I guess you could just

```css
* {
  --parent-width: parent(width);
}
.foo { /* no hack :) */
  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 Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2864#issuecomment-817814323 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 13:31:40 UTC