- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Mon, 12 Apr 2021 16:05:16 +0000
- To: public-css-archive@w3.org
> I mentioned this briefly in our F2F call, but I keep mulling it over in my mind so I wanted to put it in writing. One way to work around the ancestor hurdle is to create a contract by flagging a specific property as "inheritable". This could create a token (or something that functions similarly to a custom property) that cascades and is accessed by an inherited function. Taking the previous example and converting it could look something like: > > ```css > .foo { > width: 100px !inheritable; > } > .foo > .bar { > width: calc( inherited(width) * 0.5 ); > } > .foo > .bar > .baz { > width: calc( inherited(width) * 0.2 ); > } > ``` If you have "access" to the declaration to set `!inheritable`, you can also just set a custom property and have it inherit and use that on the property as well. The way I see it, this is very useful for libraries that need to work with host code that they don't control. -- GitHub Notification of comment by LeaVerou Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2864#issuecomment-817933925 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 16:05:18 UTC