@@ -15,6 +15,7 @@ At Risk: ''toggle()'', ''attr()''
15
15
Ignored Terms : <spacing-limit>, containing block
16
16
Ignored Vars : Cn+1, n
17
17
Inline Github Issues : yes
18
+ Default Highlight : css
18
19
</pre>
19
20
<pre class='link-defaults'>
20
21
spec: css-backgrounds-3; type: type; text: <position>
@@ -459,11 +460,11 @@ Textual Data Types</h2>
459
460
the <a lt="specified value">specified</a> and <a>computed value</a> of a property
460
461
are exactly the provided Unicode values after parsing
461
462
(which includes character set conversion and [[css-syntax-3#escaping|escaping]] ).
462
- [[!UNICODE]] [[!CSS3SYN ]]
463
+ [[!UNICODE]] [[!CSS-SYNTAX-3 ]]
463
464
464
465
<dfn export lt="CSS identifier | CSS ident | identifier | ident">CSS identifiers</dfn> ,
465
466
generically denoted by <dfn><ident></dfn> ,
466
- consist of a sequence of characters conforming to the <<ident-token>> grammar. [[!CSS3SYN ]]
467
+ consist of a sequence of characters conforming to the <<ident-token>> grammar. [[!CSS-SYNTAX-3 ]]
467
468
Identifiers cannot be quoted;
468
469
otherwise they would be interpreted as strings.
469
470
CSS properties accept two classes of <a>identifiers</a> :
@@ -657,7 +658,7 @@ Quoted Strings: the <<string>> type</h3>
657
658
[=Strings=] are denoted by <dfn id="string-value"><string></dfn>
658
659
and consist of a sequence of characters delimited by double quotes or
659
660
single quotes. They correspond to the <<string-token>> production
660
- in the <a href="https://www.w3.org/TR/css-syntax/">CSS Syntax Module</a> [[!CSS3SYN ]] .
661
+ in the <a href="https://www.w3.org/TR/css-syntax/">CSS Syntax Module</a> [[!CSS-SYNTAX-3 ]] .
661
662
662
663
<div class=example>
663
664
Double quotes cannot occur inside double quotes, unless
@@ -706,51 +707,85 @@ Quoted Strings: the <<string>> type</h3>
706
707
<h3 id="urls">
707
708
Resource Locators: the <<url>> type</h3>
708
709
709
- The <dfn>url()</dfn> <a>functional notation</a> ,
710
- denoted by <<url>> ,
710
+ The <<url>> type
711
711
represents a <l spec=url> [=/URL=] </l> ,
712
712
which is a pointer to a resource.
713
- The typical syntax of a <<url>> is:
714
713
715
- <pre class="prod"><dfn id="url-value"><url></dfn> = url( <<string>> <<url-modifier>> * )</pre>
714
+ Typically, a <<url>> is written with the <dfn>url()</dfn>
715
+ or <dfn>fetch()</dfn> <a>functional notations</a> :
716
+
717
+ <pre class="prod">
718
+ <dfn id="url-value"><url></dfn> = url( <<string>> <<url-modifier>> * ) |
719
+ fetch( <<string>> <<url-modifier>> * )
720
+ </pre>
716
721
717
722
<div class="example">
718
- Below is an example of a URL being used as a background image:
723
+ This example shows a URL being used as a background image:
719
724
720
- <pre> body { background: url("http://www.example.com/pinkish.gif") }</pre>
725
+ <pre highlight=css>
726
+ body { background: url("http://www.example.com/pinkish.gif") }
727
+ </pre>
721
728
</div>
722
729
723
- A <<url>> may alternately be written without quotation marks around the URL itself,
730
+ For legacy reasons, a ''url()'' can be written without quotation marks around the URL itself,
724
731
in which case it is <a lt="consume a url token" spec=css-syntax-3>specially-parsed</a>
725
- as a <<url-token>> [[!CSS3SYN]] .
732
+ as a <<url-token>> [[!CSS-SYNTAX-3]] .
733
+ Because of this special parsing, ''url()'' is only able to specify its URL literally;
734
+ ''fetch()'' lacks this special parsing rule,
735
+ and so its URL can be provided by functions,
736
+ such as ''var()'' .
726
737
727
738
<div class="example">
728
739
For example, the following declarations are identical:
740
+
729
741
<pre>
730
742
background: url("http://www.example.com/pinkish.gif");
731
743
background: url(http://www.example.com/pinkish.gif);
732
744
</pre>
745
+
746
+ And these have the same meaning as well:
747
+
748
+ <pre>
749
+ background: fetch("http://www.example.com/pinkish.gif");
750
+ --foo: "http://www.example.com/pinkish.gif";
751
+ background: fetch(var(--foo));
752
+ </pre>
753
+
754
+ But this does <em> not</em> work:
755
+
756
+ <pre>
757
+ --foo: "http://www.example.com/pinkish.gif";
758
+ background: url(var(--foo));
759
+ </pre>
760
+
761
+ ...because the unescaped "(" in the value causes a parse error,
762
+ so the entire declaration is thrown out as invalid.
733
763
</div>
734
764
735
- Note: This unquoted syntax cannot accept a <<url-modifier>> argument
736
- and has extra escaping requirements:
737
- parentheses, <a href="https://www.w3.org/TR/css-syntax/#whitespace">whitespace</a> characters,
738
- single quotes (') and double quotes (") appearing in a URL
739
- must be escaped with a backslash,
740
- e.g. ''url(open\(parens)'' , ''url(close\)parens)'' .
741
- (In quoted <<string>> ''url()'' s,
742
- only newlines and the character used to quote the string need to be escaped.)
743
- Depending on the type of URL,
744
- it might also be possible to write these characters as URL-escapes
745
- (e.g. ''url(open%28parens)'' or ''url(close%29parens)'' )
746
- as described in [[URL]] .
765
+ <div class=note>
766
+ The unquoted ''url()'' syntax cannot accept a <<url-modifier>> argument
767
+ and has extra escaping requirements:
768
+ parentheses, <a href="https://www.w3.org/TR/css-syntax/#whitespace">whitespace</a> characters,
769
+ single quotes (') and double quotes (") appearing in a URL
770
+ must be escaped with a backslash,
771
+ e.g. ''url(open\(parens)'' , ''url(close\)parens)'' .
772
+ (In quoted <<string>> ''url()'' s,
773
+ only newlines and the character used to quote the string need to be escaped.)
774
+ Depending on the type of URL,
775
+ it might also be possible to write these characters as URL-escapes
776
+ (e.g. ''url(open%28parens)'' or ''url(close%29parens)'' )
777
+ as described in [[URL]] .
778
+
779
+ The precise requirements for parsing the unquoted ''url()'' syntax
780
+ are normatively defined in [[!CSS-SYNTAX-3]] .
781
+ </div>
747
782
748
783
Some CSS contexts (such as ''@import'' ) also allow a <<url>>
749
- to be represented by a bare <<string>> , without the ''url()'' wrapper.
784
+ to be represented by a bare <<string>> , without the function wrapper.
750
785
In such cases the string behaves identically to a ''url()'' function containing that string.
751
786
752
787
<div class="example">
753
- For example, the following statements are identical :
788
+ For example, the following statements act identically :
754
789
<pre>
755
790
@import url("base-theme.css");
756
791
@import "base-theme.css";
@@ -950,7 +985,7 @@ Integers: the <<integer>> type</h3>
950
985
When written literally,
951
986
an <dfn export>integer</dfn> is one or more decimal digits ''0'' through ''9''
952
987
and corresponds to a subset of the <<number-token>> production
953
- in the CSS Syntax Module [[!CSS3SYN ]] .
988
+ in the CSS Syntax Module [[!CSS-SYNTAX-3 ]] .
954
989
The first digit of an integer may be immediately preceded by <css> -</css> or <css> +</css>
955
990
to indicate the integer's sign.
956
991
@@ -996,7 +1031,7 @@ Real Numbers: the <<number>> type</h3>
996
1031
or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits
997
1032
and optionally an exponent composed of "e" or "E" and an integer.
998
1033
It corresponds to the <<number-token>> production
999
- in the <a href="https://www.w3.org/TR/css-syntax/">CSS Syntax Module</a> [[!CSS3SYN ]] .
1034
+ in the <a href="https://www.w3.org/TR/css-syntax/">CSS Syntax Module</a> [[!CSS-SYNTAX-3 ]] .
1000
1035
As with integers, the first character of a number may be immediately preceded by <css> -</css> or <css> +</css>
1001
1036
to indicate the number's sign.
1002
1037
@@ -1031,7 +1066,7 @@ Numbers with Units: <a>dimension</a> values</h3>
1031
1066
immediately followed by a unit identifier,
1032
1067
which is an <a>identifier</a> .
1033
1068
It corresponds to the <<dimension-token>> production
1034
- in the <a href="https://www.w3.org/TR/css-syntax/">CSS Syntax Module</a> [[!CSS3SYN ]] .
1069
+ in the <a href="https://www.w3.org/TR/css-syntax/">CSS Syntax Module</a> [[!CSS-SYNTAX-3 ]] .
1035
1070
Like keywords, unit identifiers are <a>ASCII case-insensitive</a> .
1036
1071
1037
1072
<wpt>
@@ -1104,7 +1139,7 @@ Percentages: the <<percentage>> type</h3>
1104
1139
a <dfn export>percentage</dfn> consists of a <a>number</a>
1105
1140
immediately followed by a percent sign <css> %</css> .
1106
1141
It corresponds to the <<percentage-token>> production
1107
- in the <a href="https://www.w3.org/TR/css-syntax/">CSS Syntax Module</a> [[!CSS3SYN ]] .
1142
+ in the <a href="https://www.w3.org/TR/css-syntax/">CSS Syntax Module</a> [[!CSS-SYNTAX-3 ]] .
1108
1143
1109
1144
Percentage values are always relative to another quantity,
1110
1145
for example a length.
0 commit comments