@@ -122,15 +122,17 @@ Importing Style Sheets: the ''@import'' rule</h2>
122
122
as if they were written literally into the stylesheet at the point of the ''@import'' .
123
123
124
124
Any ''@import'' rules must precede all other valid at-rules and style rules in a style sheet
125
- (ignoring ''@charset'' ), or else the ''@import'' rule is invalid.
125
+ (ignoring ''@charset'' and empty [=@layer=] definitions ), or else the ''@import'' rule is invalid.
126
126
The syntax of ''@import'' is:
127
127
128
128
<pre class='prod'>
129
129
@import [ <<url>> | <<string>> ]
130
+ [ layer(<<layer-ident>> ?) ]?
130
131
[ supports( [ <<supports-condition>> | <<declaration>> ] ) ]?
131
132
<<media-query-list>> ? ;</pre>
132
133
133
134
where the <<url>> or <<string>> gives the URL of the style sheet to be imported,
135
+ the optional <<layer-ident>> assigns imported rules to the indicated [=cascade layer=] ,
134
136
and the optional [<<supports-condition>>|<<declaration>>] and <<media-query-list>>
135
137
(collectively, the <dfn export>import conditions</dfn> )
136
138
state the conditions under which it applies.
@@ -145,6 +147,16 @@ Importing Style Sheets: the ''@import'' rule</h2>
145
147
<pre> @import url("narrow.css") supports(display: flex) handheld and (max-width: 400px);</pre>
146
148
</div>
147
149
150
+ <div class="example">
151
+ The following layer imports load the style sheets into
152
+ the ''framework component'' layer, and an un-named layer, respectively:
153
+
154
+ <pre>
155
+ @import url("tabs.css") layer(framework component);
156
+ @import url("override.css") layer();
157
+ </pre>
158
+ </div>
159
+
148
160
If a <<string>> is provided,
149
161
it must be interpreted as a <<url>> with the same value.
150
162
@@ -1104,22 +1116,9 @@ Cascade Layers</h3>
1104
1116
Declaring Cascade Layers: the ''@layer'' rule</h4>
1105
1117
1106
1118
The <dfn at-rule id="at-ruledef-layer">@layer</dfn> rule
1107
- defines an explicit [=cascade layer=] ,
1108
- with the option to assign style rules as either a block or an import.
1109
-
1110
- The import syntax is:
1111
-
1112
- <pre class='prod'>
1113
- @layer <<layer-ident>> ? <<url>> ;
1114
- </pre>
1115
-
1116
- Such ''@layer'' import rules have the same restrictions and processing
1117
- as ''@import'' (see [[#at-import]] ),
1118
- except that the imported rules are assigned to the indicated layer.
1119
-
1120
- Issue(w3c/csswg-drafts#5681): Is ''@layer'' the proper way to handle layered url imports?
1119
+ defines an explicit [=cascade layer=] , with the option to assign style rules.
1121
1120
1122
- The block syntax is:
1121
+ The block layer-assignment syntax is:
1123
1122
1124
1123
<pre class='prod'>
1125
1124
@layer <<layer-ident>> ? {
@@ -1131,7 +1130,7 @@ Declaring Cascade Layers: the ''@layer'' rule</h4>
1131
1130
as a [=conditional rule=] [[CSS-CONDITIONAL-3]]
1132
1131
with a true condition.
1133
1132
1134
- In both cases the optional <dfn for='@layer'><<layer-ident>></dfn>
1133
+ The optional <dfn for='@layer'><<layer-ident>></dfn>
1135
1134
is a [=CSS identifier=] (<<ident>> )
1136
1135
that represents its <dfn>layer name</dfn> .
1137
1136
If the [=layer name=] matches that of a [=cascade layer=]
@@ -1153,7 +1152,7 @@ Declaring Cascade Layers: the ''@layer'' rule</h4>
1153
1152
</pre>
1154
1153
1155
1154
Such empty ''@layer'' are allowed
1156
- anywhere either import ''@layer '' or block ''@layer'' rules are allowed.
1155
+ anywhere either ''@import '' or other ''@layer'' rules are allowed.
1157
1156
1158
1157
Issue(w3c/csswg-drafts#5853): Provide an attribute for assigning link or style elements to cascade layers
1159
1158
@@ -1523,6 +1522,7 @@ Additions Since Level 4</h3>
1523
1522
The following features have been added since
1524
1523
<a href="https://www.w3.org/TR/css-cascade-4/">Level 4</a> :
1525
1524
1525
+ * Added ''layer()'' option to [=@import=] definition.
1526
1526
* Added [=cascade layers=] to the [=cascade=] sort criteria.
1527
1527
* Defined style attributes as a distinct step of the [=cascade=] sort criteria.
1528
1528
* Introduced the ''@layer'' rule for defining cascade layers.
0 commit comments