Skip to content

Commit 64308a4

Browse files
committed
Update all the remaining examples.
--HG-- extra : rebase_source : 85c62b591e849fdc2f791c19d5a8a2e8eafb2b9e
1 parent 457f00e commit 64308a4

2 files changed

Lines changed: 19 additions & 64 deletions

File tree

css-variables/Overview.html

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Variables
374374
the document. Its value can be referenced via the "header-color"
375375
variable:
376376

377-
<pre>h1 { background-color: var(header-color); }</pre>
377+
<pre>h1 { background-color: $header-color; }</pre>
378378

379379
<p> The preceding rule is equivalent to writing ‘<code
380380
class=css>background-color: #06c;</code>’, except that the variable
@@ -400,7 +400,7 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Variables
400400
:root { var-color: blue; }
401401
div { var-color: green; }
402402
#alert { var-color: red; }
403-
* { color: var(color); }
403+
* { color: $color; }
404404

405405
&lt;p>I inherited blue from the root element!&lt;/p>
406406
&lt;div>I got green set directly on me!&lt;/div>
@@ -425,7 +425,7 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Variables
425425
<pre>
426426
:root {
427427
var-main-color: #c06;
428-
var-accent-background: linear-gradient(to top, var(main-color), white);
428+
var-accent-background: linear-gradient(to top, $main-color, white);
429429
}</pre>
430430

431431
<p> The ‘<code class=property>var-accent-background</code>’ property
@@ -439,8 +439,8 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Variables
439439

440440
<pre>
441441
:root {
442-
var-one: calc(var(two) + 20px);
443-
var-two: calc(var(one) - 20px);
442+
var-one: calc($two + 20px);
443+
var-two: calc($one - 20px);
444444
}</pre>
445445

446446
<p> Both ‘<code class=property>var-one</code>’ and ‘<code
@@ -465,8 +465,8 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Variables
465465
<pre>
466466
&lt;one>&lt;two>&lt;three />&lt;/two>&lt;/one>
467467
one { var-foo: 10px; }
468-
two { var-bar: calc(var(foo) + 10px); }
469-
three { var-foo: calc(var(bar) + 10px); }</pre>
468+
two { var-bar: calc($foo + 10px); }
469+
three { var-foo: calc($bar + 10px); }</pre>
470470

471471
<p> The &lt;one> element defines a value for ‘<code
472472
class=property>var-foo</code>’. The &lt;two> element inherits this
@@ -491,32 +491,7 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Variables
491491
variable an <a href="#invalid-variable"><i>invalid variable</i></a>. This
492492
is represented by the keyword ‘<code class=css>invalid</code>’, but
493493
that keyword has no special meaning in itself, and is valid if set
494-
explicitly in a variable property.
495-
496-
<div class=example>
497-
<pre>
498-
&lt;div>
499-
&lt;p>Sample text&lt;/p>
500-
&lt;/div>
501-
&lt;style>
502-
p { var-foo: invalid; }
503-
div,p { font-family: var(foo); }
504-
&lt;/style></pre>
505-
506-
<p> In this example, the "foo" variable is an <a
507-
href="#invalid-variable"><i>invalid variable</i></a> at the time the DIV
508-
element references it, because the ‘<code
509-
class=property>var-foo</code>’ property still has its initial value.
510-
This causes the DIV's ‘<code class=property>font-family</code>
511-
property to compute to the initial value for ‘<code
512-
class=property>font-family</code>’.
513-
514-
<p> On the other hand, the P element defines an explicit value for the
515-
<code class=property>var-foo</code>’ property. Its ‘<code
516-
class=property>font-family</code>’ property thus references a font
517-
named "invalid".
518-
</div>
519-
<!--
494+
explicitly in a variable property. <!--
520495
UUUUUUUU UUUUUUUU iiii
521496
U::::::U U::::::U i::::i
522497
U::::::U U::::::U iiii
@@ -541,6 +516,7 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Variables
541516
ggg::::::ggg
542517
gggggg
543518
-->
519+
544520

545521
<h2 id=using-variables><span class=secno>3. </span> Using Variables</h2>
546522

@@ -739,7 +715,7 @@ <h3 id=using-invalid-variables><span class=secno>3.4. </span> Using Invalid
739715
<pre>
740716
:root { var-not-a-color: 20px; }
741717
p { background-color: red; }
742-
p { background-color: var(not-a-color); }</pre>
718+
p { background-color: $not-a-color; }</pre>
743719

744720
<p> the &lt;p> elements will have transparent backgrounds (the initial
745721
value for ‘<code class=property>background-color</code>’), rather

css-variables/Overview.src.html

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ <h2 id="defining-variables">
235235
This property is then inherited to the elements in the rest of the document.
236236
Its value can be referenced via the "header-color" variable:
237237

238-
<pre>h1 { background-color: var(header-color); }</pre>
238+
<pre>h1 { background-color: $header-color; }</pre>
239239

240240
<p>
241241
The preceding rule is equivalent to writing ''background-color: #06c;'',
@@ -263,7 +263,7 @@ <h2 id="defining-variables">
263263
:root { var-color: blue; }
264264
div { var-color: green; }
265265
#alert { var-color: red; }
266-
* { color: var(color); }
266+
* { color: $color; }
267267

268268
&lt;p>I inherited blue from the root element!&lt;/p>
269269
&lt;div>I got green set directly on me!&lt;/div>
@@ -287,7 +287,7 @@ <h2 id="defining-variables">
287287
<pre>
288288
:root {
289289
var-main-color: #c06;
290-
var-accent-background: linear-gradient(to top, var(main-color), white);
290+
var-accent-background: linear-gradient(to top, $main-color, white);
291291
}</pre>
292292

293293
<p>
@@ -301,8 +301,8 @@ <h2 id="defining-variables">
301301

302302
<pre>
303303
:root {
304-
var-one: calc(var(two) + 20px);
305-
var-two: calc(var(one) - 20px);
304+
var-one: calc($two + 20px);
305+
var-two: calc($one - 20px);
306306
}</pre>
307307

308308
<p>
@@ -327,8 +327,8 @@ <h2 id="defining-variables">
327327
<pre>
328328
&lt;one>&lt;two>&lt;three />&lt;/two>&lt;/one>
329329
one { var-foo: 10px; }
330-
two { var-bar: calc(var(foo) + 10px); }
331-
three { var-foo: calc(var(bar) + 10px); }</pre>
330+
two { var-bar: calc($foo + 10px); }
331+
three { var-foo: calc($bar + 10px); }</pre>
332332

333333
<p>
334334
The &lt;one> element defines a value for 'var-foo'.
@@ -353,28 +353,6 @@ <h2 id="defining-variables">
353353
but that keyword has no special meaning in itself,
354354
and is valid if set explicitly in a variable property.
355355

356-
<div class='example'>
357-
<pre>
358-
&lt;div>
359-
&lt;p>Sample text&lt;/p>
360-
&lt;/div>
361-
&lt;style>
362-
p { var-foo: invalid; }
363-
div,p { font-family: var(foo); }
364-
&lt;/style></pre>
365-
366-
<p>
367-
In this example,
368-
the "foo" variable is an <i>invalid variable</i> at the time the DIV element references it,
369-
because the 'var-foo' property still has its initial value.
370-
This causes the DIV's 'font-family' property to compute to the initial value for 'font-family'.
371-
372-
<p>
373-
On the other hand,
374-
the P element defines an explicit value for the 'var-foo' property.
375-
Its 'font-family' property thus references a font named "invalid".
376-
</div>
377-
378356

379357
<!--
380358
UUUUUUUU UUUUUUUU iiii
@@ -480,6 +458,7 @@ <h3 id='var-glyph'>
480458
}</pre>
481459
</div>
482460

461+
483462
<h3 id='var-function'>
484463
Default Values - the ''var()'' notation</h3>
485464

@@ -615,7 +594,7 @@ <h3 id='using-invalid-variables'>
615594
<pre>
616595
:root { var-not-a-color: 20px; }
617596
p { background-color: red; }
618-
p { background-color: var(not-a-color); }</pre>
597+
p { background-color: $not-a-color; }</pre>
619598

620599
<p>
621600
the &lt;p> elements will have transparent backgrounds

0 commit comments

Comments
 (0)