@@ -4531,6 +4531,38 @@ Type Checking</h3>
4531
4531
might become valid in Quirks Mode
4532
4532
(and have its result interpreted as a ''px'' length).
4533
4533
4534
+ <h4 id='calc-context'>
4535
+ Calculation Contexts</h4>
4536
+
4537
+ Numeric values can be interpreted in various <dfn export>calculation contexts</dfn> ,
4538
+ depending on where they are used,
4539
+ which defines how <<percentage>> values resolve,
4540
+ etc.
4541
+
4542
+ <p class=example>
4543
+ For example, in 'top' , a <<percentage>> value
4544
+ is resolved against the size of the containing block,
4545
+ making it act as a <<length>> .
4546
+ A single property can define multiple [=calculation contexts=] ;
4547
+ for example, in 'background-size'
4548
+ one value resolves <<percentages>> against the width of the [=background sizing area=]
4549
+ while the other resolves them against the height.
4550
+
4551
+ [=Math functions=] always inherit the [=calculation context=] from wherever they're used.
4552
+ That is, in ''top: calc(25% + 50px)'' ,
4553
+ the <<percentage>> is resolved <em> as normal</em> for 'top' ,
4554
+ as if ''top: 25%'' were specified
4555
+ (and then has ''50px'' added to its value).
4556
+
4557
+ Unless otherwise defined,
4558
+ all other functions <strong> do not inherit a [=calculation context=] </strong> ,
4559
+ and instead define their own [=calculation contexts=]
4560
+ for their numeric arguments.
4561
+ For example, in ''top: anchor(25%)'' ,
4562
+ the <<percentage>> in the ''anchor()'' function
4563
+ is instead defined to resolve in a completely different manner
4564
+ (against the height of the default anchor element).
4565
+
4534
4566
<h4 id='calc-ieee'>
4535
4567
Infinities, NaN, and Signed Zero</h4>
4536
4568
0 commit comments