@@ -345,7 +345,7 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Custom
345345 the document. Its value can be referenced via the "header-color"
346346 variable:
347347
348- < pre > h1 { background-color: $ header-color; }</ pre >
348+ < pre > h1 { background-color: var( header-color) ; }</ pre >
349349
350350 < p > The preceding rule is equivalent to writing ‘< code
351351 class =css > background-color: #06c;</ code > ’, except that the variable
@@ -367,18 +367,28 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Custom
367367 always draw from the computed value of the associated custom property on
368368 the same element:
369369
370- < pre >
371- :root { var-color: blue; }
372- div { var-color: green; }
373- #alert { var-color: red; }
374- * { color: $color; }
375-
376- <p> I inherited blue from the root element!</p>
377- <div> I got green set directly on me!</div>
378- <div id='alert'>
379- While I got red set directly on me!
380- <p> I'm red too, because of inheritance!</p>
381- </div> </ pre >
370+ < pre > <!--
371+ --> :root { var-color: blue; }
372+ <!--
373+ --> div { var-color: green; }
374+ <!--
375+ --> #alert { var-color: red; }
376+ <!--
377+ --> * { color: var(color); }
378+ <!--
379+ -->
380+ <!--
381+ --> <p> I inherited blue from the root element!</p>
382+ <!--
383+ --> <div> I got green set directly on me!</div>
384+ <!--
385+ --> <div id='alert'>
386+ <!--
387+ --> While I got red set directly on me!
388+ <!--
389+ --> <p> I'm red too, because of inheritance!</p>
390+ <!--
391+ --> </div> </ pre >
382392 </ div >
383393
384394 < p > < a href ="#custom-property "> < i > Custom properties</ i > </ a > may use
@@ -392,27 +402,33 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Custom
392402 < div class =example >
393403 < p > This example shows a custom property safely using a variable:
394404
395- < pre >
396- :root {
397- var-main-color: #c06;
398- var-accent-background: linear-gradient(to top, $main-color, white);
399- }</ pre >
405+ < pre > <!--
406+ --> :root {
407+ <!--
408+ --> var-main-color: #c06;
409+ <!--
410+ --> var-accent-background: linear-gradient(to top, var(main-color), white);
411+ <!--
412+ --> }</ pre >
400413
401414 < p > The ‘< code class =property > var-accent-background</ code > ’ property
402415 (along with any other properties that use ‘< code
403- class =css > $ main-color</ code > ’) will automatically update when the
416+ class =css > var( main-color) </ code > ’) will automatically update when the
404417 ‘< code class =property > var-main-color</ code > ’ property is changed.
405418 </ div >
406419
407420 < div class ="example invalid-example ">
408421 < p > On the other hand, this example shows an invalid instance of variables
409422 depending on each other:
410423
411- < pre >
412- :root {
413- var-one: calc($two + 20px);
414- var-two: calc($one - 20px);
415- }</ pre >
424+ < pre > <!--
425+ --> :root {
426+ <!--
427+ --> var-one: calc(var(two) + 20px);
428+ <!--
429+ --> var-two: calc(var(one) - 20px);
430+ <!--
431+ --> }</ pre >
416432
417433 < p > Both ‘< code class =property > var-one</ code > ’ and ‘< code
418434 class =property > var-two</ code > ’ now define < a
@@ -433,11 +449,14 @@ <h2 id=defining-variables><span class=secno>2. </span> Defining Custom
433449 < p > For example, given the following structure, these custom properties
434450 are < strong > not</ strong > cyclic, and all define valid variables:
435451
436- < pre >
437- <one> <two> <three /> </two> </one>
438- one { var-foo: 10px; }
439- two { var-bar: calc($foo + 10px); }
440- three { var-foo: calc($bar + 10px); }</ pre >
452+ < pre > <!--
453+ --> <one> <two> <three /> </two> </one>
454+ <!--
455+ --> one { var-foo: 10px; }
456+ <!--
457+ --> two { var-bar: calc(var(foo) + 10px); }
458+ <!--
459+ --> three { var-foo: calc(var(bar) + 10px); }</ pre >
441460
442461 < p > The <one> element defines a value for ‘< code
443462 class =property > var-foo</ code > ’. The <two> element inherits this
@@ -562,7 +581,7 @@ <h2 id=using-variables><span class=secno>3. </span> Using Variables - the
562581 < pre > <!--
563582 --> :root { var-looks-valid: 20px; }
564583<!--
565- --> p { background-color: $ looks-valid; }</ pre >
584+ --> p { background-color: var( looks-valid) ; }</ pre >
566585
567586 < p > Since ‘< code class =css > 20px</ code > ’ is an invalid value for
568587 ‘< code class =property > background-color</ code > ’, this instance of the
@@ -630,7 +649,7 @@ <h3 id=using-invalid-variables><span class=secno>3.1. </span> Using Invalid
630649<!--
631650 --> p { background-color: red; }
632651<!--
633- --> p { background-color: $ not-a-color; }</ pre >
652+ --> p { background-color: var( not-a-color) ; }</ pre >
634653
635654 < p > the <p> elements will have transparent backgrounds (the initial
636655 value for ‘< code class =property > background-color</ code > ’), rather
0 commit comments