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

Re: [csswg-drafts] css expression inheritance

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Mon, 11 Jun 2018 16:22:49 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-396301862-1528734158-sysbot+gh@w3.org>
This is not currently possible with unregistered custom properties (the default).

If you [register the property with `syntax: "<length>"` or similar](https://drafts.css-houdini.org/css-properties-values-api/), then `--foo: 1em` will resolve based on the `font-size` of the declaring element, not the element that finally uses the variable.

One of the plans for Variables 2 is to add a !-syntax for asking the browser to immediately evaluate a custom property as a given type, based on information from the declaring element, like `--foo: 1em !type <length>;`, which would let you do this without having to register it.

@jonjohnjohnson That's a different issue entirely, related to letting you "build up" a variable value as you nest things.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2749#issuecomment-396301862 using your GitHub account
Received on Monday, 11 June 2018 16:22:53 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 19 September 2019 01:18:58 UTC