You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defining Custom Properties: the <spandata-autolink="property" class="property" title="var-*">var-*</span> family of properties</a></li><li><ahref="#using-variables"><spanclass="secno">3 </span>
78
-
Using Cascading Variables: the <spandata-autolink="maybe" class="css">var()</span> notation</a><ulclass="toc"><li><ahref="#invalid-variables"><spanclass="secno">3.1 </span>
77
+
Defining Custom Properties: the <spandata-autolink="property" href="#var-" class="property" title="var-*">var-*</span> family of properties</a></li><li><ahref="#using-variables"><spanclass="secno">3 </span>
78
+
Using Cascading Variables: the <spandata-autolink="maybe" href="#variable-type" class="css">var()</span> notation</a><ulclass="toc"><li><ahref="#invalid-variables"><spanclass="secno">3.1 </span>
</p><pclass="note"> Note: Authors are recommended to choose custom property names
160
160
so that the part after the "var-" is an identifier by itself,
161
161
so that it can be referenced without <ahref="http://www.w3.org/TR/CSS21/syndata.html#escaped-characters">character escaping</a>.
162
-
For example, <adata-autolink="property" class="property" title="var-0">var-0</a> needs to be referenced as <adata-autolink="maybe" class="css">var(\30)</a>,
163
-
because <adata-autolink="maybe" class="css">0</a> isn't a valid identifier.
164
-
(U+0030 is the hexadecimal code for the <adata-autolink="maybe" class="css">0</a> character.)
162
+
For example, <adata-autolink="property" class="property" title="var-0">var-0</a> needs to be referenced as <spandata-autolink="maybe" class="css">var(\30)</span>,
163
+
because <spandata-autolink="maybe" class="css">0</span> isn't a valid identifier.
164
+
(U+0030 is the hexadecimal code for the <spandata-autolink="maybe" class="css">0</span> character.)
Every <adata-autolink="link" href="#custom-property">custom property</a> defines a corresponding <adata-autolink="link" href="#cascading-variable">variable</a>
246
246
with the same name, minus the "var-" prefix.
247
-
For example, the custom property <adata-autolink="property" class="property" title="var-foo">var-foo</a> defines a variable named <adata-autolink="maybe" class="css">foo</a>.
247
+
For example, the custom property <adata-autolink="property" class="property" title="var-foo">var-foo</a> defines a variable named <spandata-autolink="maybe" class="css">foo</span>.
248
248
See the next chapter for details on how to use variables.
249
249
250
250
</p><pclass="note"> Note: <adata-autolink="link" href="#custom-property">Custom properties</a> can be put to several other uses, of course.
<p> The <one> element defines a value for <adata-autolink="property" class="property" title="var-foo">var-foo</a>.
354
354
The <two> element inherits this value,
355
-
and additionally assigns a value to <adata-autolink="property" class="property" title="var-bar">var-bar</a> using the <adata-autolink="maybe" class="css">foo</a> variable.
355
+
and additionally assigns a value to <adata-autolink="property" class="property" title="var-bar">var-bar</a> using the <spandata-autolink="maybe" class="css">foo</span> variable.
356
356
Finally,
357
357
the <three> element inherits the <adata-autolink="property" class="property" title="var-bar">var-bar</a> value
358
358
<em>after</em> variable substitution
359
-
(in other words, it sees the value <adata-autolink="maybe" class="css">calc(10px + 10px)</a>),
359
+
(in other words, it sees the value <spandata-autolink="maybe" class="css">calc(10px + 10px)</span>),
360
360
and then redefines <adata-autolink="property" class="property" title="var-foo">var-foo</a> in terms of that value.
361
361
Since the value it inherited for <adata-autolink="property" class="property" title="var-bar">var-bar</a> no longer contains a reference to the <adata-autolink="property" class="property" title="var-foo">var-foo</a> property defined on <one>,
362
-
defining <adata-autolink="property" class="property" title="var-foo">var-foo</a> using the <adata-autolink="maybe" class="css">var(bar)</a> variable is not cyclic,
362
+
defining <adata-autolink="property" class="property" title="var-foo">var-foo</a> using the <spandata-autolink="maybe" class="css">var(bar)</span> variable is not cyclic,
363
363
and actually defines a value that will eventually
364
364
(when referenced as a variable in a normal property)
365
-
resolve to <adata-autolink="maybe" class="css">30px</a>.
365
+
resolve to <spandata-autolink="maybe" class="css">30px</span>.
</p><pclass="note"> Note: The syntax of <adata-autolink="link" class="production" href="#fallback-type"><var><fallback></var></a>, like that of <adata-autolink="link" href="#custom-property">custom properties</a>, allows commas.
421
-
For example, a variable use like <adata-autolink="maybe" class="css">var(foo, red, blue)</a> defines a fallback of <adata-autolink="maybe" class="css">red, blue</a>;
421
+
For example, a variable use like <spandata-autolink="maybe" class="css">var(foo, red, blue)</span> defines a fallback of <spandata-autolink="maybe" class="css">red, blue</span>;
422
422
that is, anything between the first comma and the end of the function is considered a <adata-autolink="link" class="production" href="#fallback-type"><var><fallback></var></a> value.
423
423
424
424
</p><p> A property value containing a variable must be assumed to be valid at parse time.
<p> Since <adata-autolink="maybe" class="css">20px</a> is an invalid value for <adata-autolink="property" class="property" title="background-color">background-color</a>,
524
-
this instance of the property computes to <adata-autolink="maybe" class="css">transparent</a>
523
+
<p> Since <spandata-autolink="maybe" class="css">20px</span> is an invalid value for <adata-autolink="property" class="property" title="background-color">background-color</a>,
524
+
this instance of the property computes to <spandata-autolink="maybe" class="css">transparent</span>
525
525
(the initial value for <adata-autolink="property" class="property" title="background-color">background-color</a>)
<divdata-fill-with="property-index"><tableclass="proptable"><thead><tr><thscope="col">Name</th><thscope="col">Values</th><thscope="col">Initial</th><thscope="col">Applies To</th><thscope="col">Inh.</th><thscope="col">%ages</th><thscope="col">Media</th><thscope="col">Computed Value</th></tr><tr><thscope="row"><adata-property=""data-autolink="link" href="#var-">var-*</a></th><td>[ <adata-autolink="link" class="production"href="#value-production"><var><value></var></a> | <adata-autolink="link" class="production"href="#cdo-production"><var><CDO></var></a> | <adata-autolink="link" class="production"href="#cdc-production"><var><CDC></var></a> ]+</td><td>(nothing, see prose)</td><td>all elements</td><td>yes</td><td></td><td>all</td><td>specified value with variables substituted (but see prose for "invalid variables")</td></tr></thead></table></div>
921
+
<divdata-fill-with="property-index"><tableclass="proptable"><thead><tr><thscope="col">Name</th><thscope="col">Value</th><thscope="col">Initial</th><thscope="col">Applies To</th><thscope="col">Inh.</th><thscope="col">%ages</th><thscope="col">Media</th><thscope="col">Computed Value</th><thscope="col">Animatable</th><thscope="col">Values</th></tr><tr><thscope="row"><adata-property="">var-*</a></th><td></td><td>(nothing, see prose)</td><td>all elements</td><td>yes</td><td></td><td>all</td><td>specified value with variables substituted (but see prose for "invalid variables")</td><td>no</td><td>[ <adata-autolink="link" class="production"><var><value></var></a> | <adata-autolink="link" class="production"><var><CDO></var></a> | <adata-autolink="link" class="production"><var><CDC></var></a> ]+</td></tr></thead></table></div>
0 commit comments