Skip to content

Commit 6492353

Browse files
committed
[css-values-5] Define inherit() for custom properties #2864
1 parent 5666cec commit 6492353

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

css-values-5/Overview.bs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,37 @@ Custom Property References: the ''var()'' notation</h3>
14761476
see the <a href="https://www.w3.org/TR/css-variables/#using-variables">CSS Custom Properties for Cascading Variables Module</a>.
14771477
[[CSS-VARIABLES]]
14781478

1479+
<h3 id="inherit-notation">
1480+
Inherited Value References: the ''inherit()'' notation</h3>
1481+
1482+
Like the ''inherit'' keyword, the <dfn>inherit()</dfn> [=functional notation=]
1483+
resolves to the [=computed value=] of a property on the parent.
1484+
Rather than resolving to the value of the same property, however,
1485+
it resolves to the tokenized [=computed value=]
1486+
of the property specified as its first argument.
1487+
Its second argument, if present, is used as a fallback
1488+
in case the first argument resolves to the [=guaranteed-invalid value=].
1489+
1490+
''inherit()'' is an [=arbitrary substitution function=]
1491+
whose syntax is defined as:
1492+
1493+
<pre class=prod>
1494+
<dfn><<inherit()>></dfn> = inherit( <<custom-property-name>>, <<declaration-value>>? )
1495+
</pre>
1496+
1497+
To <dfn export>[=resolve an arbitrary substitution function|resolve an inherit() function=]</dfn>,
1498+
return the [=inherited value=] of the [=custom property=] specified by the first argument,
1499+
and (if specified) the fallback specified by the second argument.
1500+
1501+
Note: Future levels of CSS may allow specifying standard CSS properties in ''inherit()'';
1502+
however because the tokenization of [=computed values=]
1503+
is not fully standardized for all CSS properties,
1504+
this feature is deferred from Level 5.
1505+
Note that the [=computed value=] differs from the [=used value=],
1506+
and is not always the resolved value returned by {{getComputedStyle()}};
1507+
thus even if ''inherit(width)'' were allowed,
1508+
it would frequently return the keyword ''width/auto'', not the used <<length>>.
1509+
14791510
<!-- Big Text: attr()
14801511

14811512
███▌ █████▌ █████▌ ████▌ ██ ██

0 commit comments

Comments
 (0)