@@ -20,8 +20,8 @@ Previous Version: https://www.w3.org/TR/2001/WD-css3-values-20010713/
20
20
Editor : Tab Atkins, Google, http://xanthir.com/contact/
21
21
Editor : fantasai, http://fantasai.inkedblade.net/contact
22
22
Former Editor : Håkon Wium Lie, Opera Software, howcome@opera.com
23
- Abstract : This CSS3 module describes the common values and units that CSS properties accept and the syntax used for describing them in CSS property definitions.
24
- At Risk : ''toggle()'', '' attr()''
23
+ Abstract : This CSS module describes the common values and units that CSS properties accept and the syntax used for describing them in CSS property definitions.
24
+ At Risk : ''attr()''
25
25
Ignored Terms : <spacing-limit>, containing block
26
26
Ignored Vars : Cn+1, n
27
27
Inline Github Issues : yes
@@ -889,12 +889,6 @@ Relative lengths</h3>
889
889
<td> 1% of viewport's width
890
890
<tr><td> ''vh''
891
891
<td> 1% of viewport's height
892
- <!--
893
- <tr><td> ''vi''
894
- <td> 1% of viewport's size in the root element's <a>inline axis</a>
895
- <tr><td> ''vb''
896
- <td> 1% of viewport's size in the root element's <a>block axis</a>
897
- -->
898
892
<tr><td> ''vmin''
899
893
<td> 1% of viewport's smaller dimension
900
894
<tr><td> ''vmax''
@@ -994,7 +988,7 @@ Font-relative lengths: the ''em'', ''ex'', ''ch'', ''rem'' units</h4>
994
988
-->
995
989
996
990
<h4 id="viewport-relative-lengths">
997
- Viewport-percentage lengths: the ''vw'', ''vh'', <!-- ''vi'', ''vb'', --> ''vmin'', ''vmax'' units</h4>
991
+ Viewport-percentage lengths: the ''vw'', ''vh'', ''vmin'', ''vmax'' units</h4>
998
992
999
993
The <dfn export>viewport-percentage lengths</dfn> are relative to the size of the
1000
994
<a href="https://www.w3.org/TR/CSS21/visudet.html#containing-block-details">initial containing block</a> .
@@ -1023,17 +1017,7 @@ Viewport-percentage lengths: the ''vw'', ''vh'', <!-- ''vi'', ''vb'', --> ''vmin
1023
1017
<dt> <dfn id="vh" lt="vh">vh unit</dfn>
1024
1018
<dd>
1025
1019
Equal to 1% of the height of the initial containing block.
1026
- <!--
1027
- <dt> <dfn lt=vi>vi unit</dfn>
1028
- <dd>
1029
- Equal to 1% of the size of the initial containing block
1030
- in the direction of the root element's inline axis.
1031
1020
1032
- <dt> <dfn lt=vb>vb unit</dfn>
1033
- <dd>
1034
- Equal to 1% of the size of the initial containing block
1035
- in the direction of the root element's block axis.
1036
- -->
1037
1021
<dt> <dfn id="vmin" lt="vmin">vmin unit</dfn>
1038
1022
<dd>
1039
1023
Equal to the smaller of ''vw'' or ''vh'' .
@@ -1042,13 +1026,7 @@ Viewport-percentage lengths: the ''vw'', ''vh'', <!-- ''vi'', ''vb'', --> ''vmin
1042
1026
<dd>
1043
1027
Equal to the larger of ''vw'' or ''vh'' .
1044
1028
</dl>
1045
- <!--
1046
- In situations where there is no root element
1047
- or it hasn't yet been styled
1048
- (such as when evaluating <a>media queries</a> ),
1049
- the ''vi'' and ''vb'' units use the initial value of the 'writing-mode' property
1050
- to determine which axis they correspond to.
1051
- -->
1029
+
1052
1030
<!--
1053
1031
████████ ██ ██ ██ ████████ ████████ ██████
1054
1032
██ ██ ██ ██ ██ ██ ██ ██ ██
@@ -1707,186 +1685,7 @@ Range Checking</h4>
1707
1685
<h4 id='calc-serialize'>
1708
1686
Serialization</h4>
1709
1687
1710
- To serialize a ''calc()'' value:
1711
-
1712
- 1. Simplify the expression by:
1713
-
1714
- * Replacing nested ''calc()'' values with parentheses containing their contents
1715
- * Resolving all multiplications and divisions
1716
- * Combining identical units
1717
-
1718
- Note: The value-computation process can transform disparate units into identical ones.
1719
- For example, ''em'' and ''px'' are obviously different at specified-value time,
1720
- but at computed-value time they're both absolutized to ''px'' .
1721
-
1722
- The result must be a summation of unique units.
1723
- (Terms with a value of zero <strong> must</strong> be preserved in this summation.)
1724
-
1725
- 2. If this simplification process results in only a single value
1726
- (one <<number>> , one <<dimension>> , or one <<percentage>> ),
1727
- and the value being serialized is a <a>computed value</a> or later,
1728
- serialize it just as that one value,
1729
- without the ''calc()'' wrapper.
1730
- If this value is outside the allowed range for the context,
1731
- it must be clamped to the nearest allowed value.
1732
-
1733
- 3. Otherwise, serialize as a ''calc()'' containing the summation,
1734
- with the units ordered <a>ASCII case-insensitive</a> alphabetically,
1735
- the number (if present) coming before all units,
1736
- and the percentage (if present) coming after all units.
1737
-
1738
- <div class="example">
1739
- For example, ''calc(20px + 30px)'' would serialize as ''calc(50px)'' as a specified value,
1740
- or as ''50px'' as a computed value.
1741
-
1742
- A value like ''calc(20px + 0%)'' would serialize as ''calc(20px + 0%)'' ,
1743
- maintaining both terms in the serialized value.
1744
- (It's important to maintain zero-valued terms,
1745
- so the ''calc()'' doesn't suddenly "change shape" in the middle of a transition
1746
- when one of the values happens to have a zero value temporarily.
1747
- This also removes the need to "pick a unit" when all the terms are zero.)
1748
-
1749
- A value like ''calc(20px + 2em)'' would serialize as ''calc(2em + 20px)'' as a specified value
1750
- (maintaining both units as they're incompatible at specified-value time,
1751
- but sorting them alphabetically),
1752
- or as something like ''52px'' as a computed value
1753
- (''em'' values are converted to absolute lengths at computed-value time,
1754
- so assuming ''1em'' = ''16px'' ,
1755
- they combine into ''52px'' ,
1756
- which then drops the ''calc()'' wrapper.)
1757
- </div>
1758
-
1759
- See [[!CSSOM]] for further information on serialization.
1760
-
1761
- <!--
1762
- ████████ ███████ ██████ ██████ ██ ████████ ███ ███
1763
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1764
- ██ ██ ██ ██ ██ ██ ██ ██ ██
1765
- ██ ██ ██ ██ ████ ██ ████ ██ ██████ ██ ██
1766
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1767
- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
1768
- ██ ███████ ██████ ██████ ████████ ████████ ███ ███
1769
- -->
1770
-
1771
- <h3 id="toggle-notation">
1772
- Toggling Between Values: ''toggle()''</h3>
1773
-
1774
- The <dfn>toggle()</dfn> expression allows descendant elements
1775
- to cycle over a list of values instead of inheriting the same value.
1776
-
1777
- <div class='example'>
1778
- The following example makes <code> <em></code> elements italic in general,
1779
- but makes them normal if they're inside something that's italic:
1780
-
1781
- <pre> em { font-style: toggle(italic, normal); }</pre>
1782
- </div>
1783
-
1784
- <div class='example'>
1785
- The following example cycles markers for nested lists,
1786
- so that a top level list has ''disc'' -shaped markers,
1787
- but nested lists use ''list-style-type/circle'' , then ''square'' , then ''box'' ,
1788
- and then repeat through the list of marker shapes,
1789
- starting again (for the 5th list deep) with ''disc'' .
1790
-
1791
- <pre> ul { list-style-type: toggle(disc, circle, square, box); }</pre>
1792
- </div>
1793
-
1794
- The syntax of the ''toggle()'' expression is:
1795
-
1796
- <pre> toggle( <<toggle-value>> # )</pre>
1797
-
1798
- where <dfn><toggle-value></dfn> is any CSS value
1799
- that is valid where the expression is placed,
1800
- and that doesn't contain any top-level commas.
1801
- If any of the values inside are not valid,
1802
- then the entire ''toggle()'' expression is invalid.
1803
- The ''toggle()'' expression may be used as the value of any property,
1804
- but must be the only component in that property's value.
1805
-
1806
- The ''toggle()'' notation is not allowed to be nested; nor may it
1807
- contain ''attr()'' or ''calc()'' notations.
1808
- Declarations containing such constructs are invalid.
1809
-
1810
- <div class="example">
1811
- The following ''toggle()'' examples are all invalid:
1812
-
1813
- <pre>
1814
- background-position: 10px toggle(50px, 100px);
1815
- /* toggle() must be the sole value of the property */
1816
-
1817
- list-style-type: toggle(disc, 50px);
1818
- /* ''50px'' isn't a valid value of 'list-style-type' */
1819
- </pre>
1820
- </div>
1821
-
1822
- To determine the computed value of ''toggle()'' ,
1823
- first evaluate each argument as if it were the sole value of the property in which ''toggle()'' is placed
1824
- to determine the computed value that each represents,
1825
- called <var> C<sub> n</sub></var> for the <var> n</var> -th argument to ''toggle()'' .
1826
- Then, compare the property's <a>inherited value</a>
1827
- with each <var> C<sub> n</sub></var> .
1828
- For the earliest <var> C<sub> n</sub></var> that matches the <a>inherited value</a> ,
1829
- the computed value of ''toggle()'' is <var> C<sub> n+1</sub></var> .
1830
- If the match was the last argument in the list,
1831
- or there was no match,
1832
- the computed value of ''toggle()'' is the computed value that the first argument represents.
1833
-
1834
-
1835
- Note: This means that repeating values in a ''toggle()'' short-circuits the list.
1836
- For example ''toggle(1em, 2em, 1em, 4em)'' will be equivalent to ''toggle(1em, 2em)'' .
1837
-
1838
- <!-- Issue: Should this short-circuiting affect the computed value? -->
1839
-
1840
- Note: That ''toggle()'' explicitly looks at the computed value of the parent,
1841
- so it works even on non-inherited properties.
1842
- This is similar to the ''inherit'' keyword,
1843
- which works even on non-inherited properties.
1844
-
1845
- Note: That the <a href="https://www.w3.org/TR/CSS21/cascade.html#computed-value">computed value</a> of a property is an abstract set of values,
1846
- not a particular serialization [[!CSS21]] ,
1847
- so comparison between computed values should always be unambiguous and have the expected result.
1848
- For example,
1849
- a Level 2 <a property spec=css21>background-position</a> computed value
1850
- is just two offsets, each represented as an absolute length or a percentage,
1851
- so the declarations ''background-position: top center'' and ''background-position: 50% 0%''
1852
- produce identical computed values.
1853
- If the "Computed Value" line of a property definition seems to define something ambiguous or overly strict,
1854
- please <a href="#status">provide feedback</a> so we can fix it.
1855
-
1856
- If ''toggle()'' is used on a <a>shorthand property</a> ,
1857
- it sets each of its longhands to a ''toggle()'' value
1858
- with arguments corresponding to what the longhand would have recieved
1859
- had each of the original ''toggle()'' arguments been the sole value of the <a>shorthand</a> .
1860
-
1861
- <div class="example">
1862
- For example, the following shorthand declaration:
1863
-
1864
- <pre> margin: toggle(1px 2px, 4px, 1px 5px 3px);</pre>
1865
-
1866
- is equivalent to the following longhand declarations:
1867
-
1868
- <pre>
1869
- margin-top: toggle(1px, 4px, 1px);
1870
- margin-right: toggle(2px, 4px, 5px);
1871
- margin-bottom: toggle(1px, 4px, 3px);
1872
- margin-left: toggle(2px, 4px, 5px);
1873
- </pre>
1874
-
1875
- Note that, since ''1px'' appears twice in the top and bottom margins,
1876
- they will cycle between only two values
1877
- while the left and right margins cycle through three.
1878
- In other words, the declarations above will yield the same computed values
1879
- as the longhand declarations below:
1880
-
1881
- <pre>
1882
- margin-top: toggle(1px, 3px);
1883
- margin-right: toggle(2px, 4px, 5px);
1884
- margin-bottom: toggle(1px, 3px);
1885
- margin-left: toggle(2px, 4px, 5px);
1886
- </pre>
1887
-
1888
- which may not be what was intended.
1889
- </div>
1688
+ The serialization of ''calc()'' values is undefined in this level.
1890
1689
1891
1690
<!--
1892
1691
███ ████████ ████████ ████████ ███ ███
@@ -1942,10 +1741,6 @@ Ian's proposal:
1942
1741
If it's absent,
1943
1742
the default value for the given <<type-or-unit>> (from the list below) is implied.
1944
1743
1945
- Note: Unlike <<toggle-value>> s,
1946
- an ''attr()'' <<attr-fallback>> value may contain top-level commas,
1947
- as it is always the last argument in the functional notation.
1948
-
1949
1744
The attr() expression is only valid if:
1950
1745
1951
1746
<ul>
@@ -2255,19 +2050,16 @@ Changes</h2>
2255
2050
Changes since the <a href="https://www.w3.org/TR/2015/CR-css-values-3-20150611/">11 June 2015 Candidate Recomendation</a> are:
2256
2051
2257
2052
<ul>
2053
+ <li> Dropped ''toggle()'' for lack of implementations.
2258
2054
<li> Allow zero angles to be represented as ''0'' .
2259
2055
(Change due to Web-compatibility constraints in transform and gradient syntaxes.)
2260
2056
<li> Defined <a href="#local-urls">special handling</a> for fragment URLs.
2261
2057
<li> Defined an empty <<url>> resolves to an invalid resource.
2262
- <li> Defined <a href="#calc-serialize">serialization of <css>calc()</css> values</a> .
2263
2058
<li> Defined <a>compatible units</a> and <a>canonical units</a> for serialization.
2264
2059
<li> Defined case-sensitivity of ''url()'' attribute argument to match attribute selectors.
2265
2060
<li> Added definition of <<ident>> notation to definition of <a>identifiers</a> .
2266
2061
<li> Added <<length-percentage>> as a shorthand for <<length>> | <<percentage>> ,
2267
2062
along with equivalent productions for angles, numbers, times, and frequencies.
2268
- <!--
2269
- <li> Added the ''vi'' and ''vb'' units.
2270
- -->
2271
2063
<li> Various clarifications and editorial improvements.
2272
2064
</ul>
2273
2065
0 commit comments