@@ -1604,14 +1604,30 @@ Type Checking</h4>
1604
1604
are valid.
1605
1605
1606
1606
If percentages are accepted in the context in which the expression is placed,
1607
- a <<percentage-token>> has the type of the value that percentages are relative to.
1608
- For example, in the 'width' property, percentages have the <<length >> type,
1609
- and in 'opacity' they have the <<number >> type.
1607
+ and they are defined to be relative to another type besides <<number>> ,
1608
+ a <<percentage-token >> is treated as that type.
1609
+ For example, in the 'width' property, percentages have the <<length >> type.
1610
1610
A percentage only has the <<percentage>> type if in that context
1611
1611
<<percentage>> values are not used-value compatible with any other type.
1612
1612
If percentages are not normally allowed in place of the ''calc()'' ,
1613
1613
then a ''calc()'' expression containing percentages is invalid in that context.
1614
1614
1615
+ Note: Note that <<percentage>> s relative to <<number>> s,
1616
+ such as in 'opacity' ,
1617
+ are not allowed in ''calc()'' .
1618
+ Allowing this would cause significant problems with "unit algebra"
1619
+ (allowing multiplication/division of <<dimension>> s),
1620
+ and in every case so far,
1621
+ doesn't provide any new functionality.
1622
+ (For example, ''opacity: 25%'' is identical to ''opacity: .25'' ;
1623
+ it's just a trivial syntax transform.)
1624
+
1625
+ Note: Altho there are a few properties in which a bare <<number>>
1626
+ becomes a <<length>> at used-value time
1627
+ (specifically, 'line-height' and 'tab-size' ),
1628
+ <<number>> s never become "length-like" in ''calc()'' .
1629
+ They always stay as <<number>> s.
1630
+
1615
1631
Operators form sub-expressions, which gain types based on their arguments.
1616
1632
To make expressions simpler,
1617
1633
operators have restrictions on the types they accept.
0 commit comments