Skip to content

Commit 2dae56e

Browse files
committed
[css-variables] Dfn <fallback>.
1 parent 35fbc2b commit 2dae56e

2 files changed

Lines changed: 21 additions & 19 deletions

File tree

css-variables/Overview.html

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ <h2 id="introduction" data-level="1"><span class="secno">1 </span>
147147
<p> This specification defines an open-ended set of properties called <a data-autolink="link" href="#custom-property">custom properties</a>,
148148
which are used to define <a data-autolink="link" href="#cascading-variable">variables</a>.
149149

150-
</p><table class="propdef"><tbody><tr><th>Name:</th><td><dfn id="var-">var-*</dfn></td></tr><tr><th>Values:</th><td>[ <a data-autolink="link" class="production" href="#value-production"><var>&lt;value&gt;</var></a> | <a data-autolink="link" class="production" href="#cdo-production"><var>&lt;CDO&gt;</var></a> | <a data-autolink="link" class="production" href="#cdc-production"><var>&lt;CDC&gt;</var></a> ]</td></tr><tr><th>Initial:</th><td>(nothing, see prose)</td></tr><tr><th>Applies To:</th><td>all elements</td></tr><tr><th>Inherited:</th><td>yes</td></tr><tr><th>Computed Value:</th><td>specified value with variables substituted (but see prose for "invalid variables")</td></tr><tr><th>Media:</th><td>all</td></tr></tbody></table>
150+
</p><table class="propdef"><tbody><tr><th>Name:</th><td><dfn id="var-">var-*</dfn></td></tr><tr><th>Values:</th><td>[ <a data-autolink="link" class="production" href="#value-production"><var>&lt;value&gt;</var></a> | <a data-autolink="link" class="production" href="#cdo-production"><var>&lt;CDO&gt;</var></a> | <a data-autolink="link" class="production" href="#cdc-production"><var>&lt;CDC&gt;</var></a> ]+</td></tr><tr><th>Initial:</th><td>(nothing, see prose)</td></tr><tr><th>Applies To:</th><td>all elements</td></tr><tr><th>Inherited:</th><td>yes</td></tr><tr><th>Computed Value:</th><td>specified value with variables substituted (but see prose for "invalid variables")</td></tr><tr><th>Media:</th><td>all</td></tr></tbody></table>
151151
<p> A <dfn id="custom-property">custom property</dfn> is any property
152152
whose name starts with "var-",
153153
and contains at least one additional character.
@@ -163,7 +163,7 @@ <h2 id="introduction" data-level="1"><span class="secno">1 </span>
163163

164164
</p><div class="example">
165165
Custom properties define variables,
166-
referenced with the <a data-autolink="maybe" class="css">var()</a> notation,
166+
referenced with the <a data-autolink="maybe" class="css" href="#variable-type">var()</a> notation,
167167
which can be used for many purposes.
168168
For example, a page that consistently uses a small set of colors in its design
169169
can store the colors in custom properties
@@ -233,8 +233,8 @@ <h2 id="introduction" data-level="1"><span class="secno">1 </span>
233233

234234
</p><p> The initial value of a <a data-autolink="link" href="#custom-property">custom property</a> is an empty value;
235235
that is, nothing at all.
236-
This initial value has a special interaction with the <a data-autolink="maybe" class="css">var()</a> notation,
237-
which is explained in the section defining <a data-autolink="maybe" class="css">var()</a>.
236+
This initial value has a special interaction with the <a data-autolink="maybe" class="css" href="#variable-type">var()</a> notation,
237+
which is explained in the section defining <a data-autolink="maybe" class="css" href="#variable-type">var()</a>.
238238

239239
</p><p> The primary purpose of <a data-autolink="link" href="#custom-property">custom properties</a> is to define <a data-autolink="link" href="#cascading-variable">cascading variables</a>.
240240
In CSS, a <dfn title="variable|cascading variable" id="cascading-variable">cascading variable</dfn> is a value that can be substituted into other properties,
@@ -392,13 +392,14 @@ <h2 id="introduction" data-level="1"><span class="secno">1 </span>
392392

393393

394394
<h2 id="using-variables" data-level="3"><span class="secno">3 </span>
395-
Using Cascading Variables: the <a data-autolink="maybe" class="css">var()</a> notation</h2>
395+
Using Cascading Variables: the <a data-autolink="maybe" class="css" href="#variable-type">var()</a> notation</h2>
396396

397397
<p> Every <a data-autolink="link" href="#custom-property">custom property</a> automatically defines a corresponding <a data-autolink="link" href="#cascading-variable">cascading variable</a>,
398-
which can then be substituted into another property with the <a data-autolink="maybe" class="css">var()</a> function.
399-
The syntax of <a data-autolink="maybe" class="css">var()</a> is:
398+
which can then be substituted into another property with the <a data-autolink="maybe" class="css" href="#variable-type">var()</a> function.
399+
The syntax of <a data-autolink="maybe" class="css" href="#variable-type">var()</a> is:
400400

401-
</p><pre><dfn id="default-var-type">&lt;variable&gt;</dfn> = var( <var>variable-name</var> [, <a data-autolink="link" class="production"><var>&lt;fallback&gt;</var></a> ]? )
401+
</p><pre><dfn id="variable-type" title="&lt;variable&gt;|var()">&lt;variable&gt;</dfn> = var( <var>variable-name</var> [, <a data-autolink="link" class="production" href="#fallback-type"><var>&lt;fallback&gt;</var></a> ]? )
402+
<dfn id="fallback-type">&lt;fallback&gt;</dfn> = [ <a data-autolink="link" class="production" href="#value-production"><var>&lt;value&gt;</var></a> | <a data-autolink="link" class="production" href="#cdo-production"><var>&lt;CDO&gt;</var></a> | <a data-autolink="link" class="production" href="#cdc-production"><var>&lt;CDC&gt;</var></a> ]+
402403
</pre>
403404
<p> A variable can be used in place of any part of a value in any property on an element.
404405
Variables can not be used as
@@ -408,22 +409,22 @@ <h2 id="using-variables" data-level="3"><span class="secno">3 </span>
408409
(Doing so usually produces invalid syntax,
409410
or else a value whose meaning has no connection to the variable.)
410411

411-
</p><p> The <a data-autolink="link" class="production"><var>&lt;fallback&gt;</var></a> value is identical to the syntax of a <a data-autolink="link" href="#custom-property">custom property</a> value:
412+
</p><p> The <a data-autolink="link" class="production" href="#fallback-type"><var>&lt;fallback&gt;</var></a> value is identical to the syntax of a <a data-autolink="link" href="#custom-property">custom property</a> value:
412413
it accepts anything allowed by the core syntax of CSS
413414
(except that, since it's a value in a function rather than a value in a declaration,
414-
some tokens that were allowed in a <a data-autolink="link" href="#custom-property">custom property</a> don't work in a <a data-autolink="link" class="production"><var>&lt;fallback&gt;</var></a> and vice versa,
415+
some tokens that were allowed in a <a data-autolink="link" href="#custom-property">custom property</a> don't work in a <a data-autolink="link" class="production" href="#fallback-type"><var>&lt;fallback&gt;</var></a> and vice versa,
415416
because they'd close the function early).
416417

417-
</p><p class="note"> Note: The syntax of <a data-autolink="link" class="production"><var>&lt;fallback&gt;</var></a>, like that of <a data-autolink="link" href="#custom-property">custom properties</a>, allows commas.
418+
</p><p class="note"> Note: The syntax of <a data-autolink="link" class="production" href="#fallback-type"><var>&lt;fallback&gt;</var></a>, like that of <a data-autolink="link" href="#custom-property">custom properties</a>, allows commas.
418419
For example, a variable use like <a data-autolink="maybe" class="css">var(foo, red, blue)</a> defines a fallback of <a data-autolink="maybe" class="css">red, blue</a>;
419-
that is, anything between the first comma and the end of the function is considered a <a data-autolink="link" class="production"><var>&lt;fallback&gt;</var></a> value.
420+
that is, anything between the first comma and the end of the function is considered a <a data-autolink="link" class="production" href="#fallback-type"><var>&lt;fallback&gt;</var></a> value.
420421

421422
</p><p> If the variable named by the first argument is valid,
422423
the variable's value is substituted as normal.
423424
If the variable is invalid,
424-
and a <a data-autolink="link" class="production"><var>&lt;fallback&gt;</var></a> was provided,
425-
the <a data-autolink="link" class="production"><var>&lt;fallback&gt;</var></a> is substituted instead.
426-
Otherwise, the result of evaluating the <a data-autolink="maybe" class="css">var()</a> function will mean
425+
and a <a data-autolink="link" class="production" href="#fallback-type"><var>&lt;fallback&gt;</var></a> was provided,
426+
the <a data-autolink="link" class="production" href="#fallback-type"><var>&lt;fallback&gt;</var></a> is substituted instead.
427+
Otherwise, the result of evaluating the <a data-autolink="maybe" class="css" href="#variable-type">var()</a> function will mean
427428
that the containing declaration is invalid at computed-value time.
428429

429430
</p><div class="example">
@@ -894,11 +895,11 @@ <h3 id="informative" class="no-num no-ref">
894895

895896
<h2 id="index" class="no-num no-ref">
896897
Index</h2>
897-
<div data-fill-with="index"><ul class="indexlist"><li>associated style declaration, <a href="#associated-style-declaration" title="section 4.1">4.1</a></li><li>authoring tool, <a href="#authoring-tool" title="section ??">??</a></li><li>cascading variable, <a href="#cascading-variable" title="section 2">2</a></li><li>&lt;CDC&gt;, <a href="#cdc-production" title="section 2">2</a></li><li>&lt;CDO&gt;, <a href="#cdo-production" title="section 2">2</a></li><li>creator, <a href="#cssvariablesdeclaration-creator" title="section 4.2">4.2</a></li><li>CSS declaration block declarations, <a href="#css-declaration-block-declarations" title="section 4.2">4.2</a></li><li>CSSStyleDeclaration, <a href="#cssstyledeclaration" title="section 4.1">4.1</a></li><li>CSSVariablesDeclaration, <a href="#cssvariablesdeclaration" title="section 4.2">4.2</a></li><li>custom property, <a href="#custom-property" title="section 2">2</a></li><li>deleter, <a href="#cssvariablesdeclaration-deleter" title="section 4.2">4.2</a></li><li>getter, <a href="#cssvariablesdeclaration-getter" title="section 4.2">4.2</a></li><li>invalid at computed-value time, <a href="#invalid-at-computed-value-time" title="section 3.1">3.1</a></li><li>invalid variable, <a href="#invalid-variable" title="section 3.1">3.1</a></li><li>renderer, <a href="#renderer" title="section ??">??</a></li><li>setter, <a href="#cssvariablesdeclaration-setter" title="section 4.2">4.2</a></li><li>style sheet!!as conformance class, <a href="#style-sheet" title="section ??">??</a></li><li>&lt;value&gt;, <a href="#value-production" title="section 2">2</a></li><li>var-*, <a href="#var-" title="section 2">2</a></li><li>&lt;variable&gt;, <a href="#default-var-type" title="section 3">3</a></li><li>variable, <a href="#cascading-variable" title="section 2">2</a></li></ul></div>
898+
<div data-fill-with="index"><ul class="indexlist"><li>associated style declaration, <a href="#associated-style-declaration" title="section 4.1">4.1</a></li><li>authoring tool, <a href="#authoring-tool" title="section ??">??</a></li><li>cascading variable, <a href="#cascading-variable" title="section 2">2</a></li><li>&lt;CDC&gt;, <a href="#cdc-production" title="section 2">2</a></li><li>&lt;CDO&gt;, <a href="#cdo-production" title="section 2">2</a></li><li>creator, <a href="#cssvariablesdeclaration-creator" title="section 4.2">4.2</a></li><li>CSS declaration block declarations, <a href="#css-declaration-block-declarations" title="section 4.2">4.2</a></li><li>CSSStyleDeclaration, <a href="#cssstyledeclaration" title="section 4.1">4.1</a></li><li>CSSVariablesDeclaration, <a href="#cssvariablesdeclaration" title="section 4.2">4.2</a></li><li>custom property, <a href="#custom-property" title="section 2">2</a></li><li>deleter, <a href="#cssvariablesdeclaration-deleter" title="section 4.2">4.2</a></li><li>&lt;fallback&gt;, <a href="#fallback-type" title="section 3">3</a></li><li>getter, <a href="#cssvariablesdeclaration-getter" title="section 4.2">4.2</a></li><li>invalid at computed-value time, <a href="#invalid-at-computed-value-time" title="section 3.1">3.1</a></li><li>invalid variable, <a href="#invalid-variable" title="section 3.1">3.1</a></li><li>renderer, <a href="#renderer" title="section ??">??</a></li><li>setter, <a href="#cssvariablesdeclaration-setter" title="section 4.2">4.2</a></li><li>style sheet!!as conformance class, <a href="#style-sheet" title="section ??">??</a></li><li>&lt;value&gt;, <a href="#value-production" title="section 2">2</a></li><li>var-*, <a href="#var-" title="section 2">2</a></li><li>var(), <a href="#variable-type" title="section 3">3</a></li><li>&lt;variable&gt;, <a href="#variable-type" title="section 3">3</a></li><li>variable, <a href="#cascading-variable" title="section 2">2</a></li></ul></div>
898899

899900
<h2 id="property-index" class="no-num no-ref">
900901
Property index</h2>
901-
<div data-fill-with="property-index"><table class="proptable"><thead><tr><th scope="col">Name</th><th scope="col">Values</th><th scope="col">Initial</th><th scope="col">Applies To</th><th scope="col">Inh.</th><th scope="col">%ages</th><th scope="col">Media</th><th scope="col">Computed Value</th></tr><tr><th scope="row"><a data-property="" data-autolink="link" href="#var-">var-*</a></th><td>[ <a data-autolink="link" class="production" href="#value-production"><var>&lt;value&gt;</var></a> | <a data-autolink="link" class="production" href="#cdo-production"><var>&lt;CDO&gt;</var></a> | <a data-autolink="link" class="production" href="#cdc-production"><var>&lt;CDC&gt;</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>
902+
<div data-fill-with="property-index"><table class="proptable"><thead><tr><th scope="col">Name</th><th scope="col">Values</th><th scope="col">Initial</th><th scope="col">Applies To</th><th scope="col">Inh.</th><th scope="col">%ages</th><th scope="col">Media</th><th scope="col">Computed Value</th></tr><tr><th scope="row"><a data-property="" data-autolink="link" href="#var-">var-*</a></th><td>[ <a data-autolink="link" class="production" href="#value-production"><var>&lt;value&gt;</var></a> | <a data-autolink="link" class="production" href="#cdo-production"><var>&lt;CDO&gt;</var></a> | <a data-autolink="link" class="production" href="#cdc-production"><var>&lt;CDC&gt;</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>
902903

903904

904905
</body></html>

css-variables/Overview.src.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h2 id='defining-variables'>
6565

6666
<xmp class='propdef'>
6767
Name: var-*
68-
Values: [ <<value>> | <<CDO>> | <<CDC>> ]
68+
Values: [ <<value>> | <<CDO>> | <<CDC>> ]+
6969
Initial: (nothing, see prose)
7070
Applies To: all elements
7171
Inherited: yes
@@ -340,7 +340,8 @@ <h2 id='using-variables'>
340340
The syntax of ''var()'' is:
341341

342342
<pre>
343-
<dfn id='default-var-type'>&lt;variable></dfn> = var( <var>variable-name</var> [, <<fallback>> ]? )
343+
<dfn id='variable-type' title="<variable>|var()">&lt;variable></dfn> = var( <var>variable-name</var> [, <<fallback>> ]? )
344+
<dfn id='fallback-type'>&lt;fallback></dfn> = [ <<value>> | <<CDO>> | <<CDC>> ]+
344345
</pre>
345346

346347
A variable can be used in place of any part of a value in any property on an element.

0 commit comments

Comments
 (0)