@@ -1190,27 +1190,27 @@ Cascade Layers</h3>
1190
1190
or relying on source-order to resolve conflicts across layers.
1191
1191
1192
1192
<div class="example">
1193
- For example, the following generates an explicit ''defaults '' layer,
1194
- with lower cascade weight than any un-layered styles:
1193
+ For example, the following generates an explicit ''utilities '' layer,
1194
+ with higher cascade weight than any un-layered styles:
1195
1195
1196
1196
<pre class='lang-css'>
1197
- audio {
1198
- /* specificity of 0,0,1 - implicit (final) layer */
1199
- display: flex;
1197
+ @layer utilities {
1198
+ .padding-small {
1199
+ /* specificity of 0,1,0 - explicit "utilities" layer */
1200
+ padding: 0.25em;
1201
+ }
1200
1202
}
1201
1203
1202
- @layer defaults {
1203
- audio[controls] {
1204
- /* specificity of 0,1,1 - explicit "defaults" layer */
1205
- display: block;
1206
- }
1204
+ .card > .content {
1205
+ /* specificity of 0,2,0 - implicit (first) layer */
1206
+ padding: 1em;
1207
1207
}
1208
1208
</pre>
1209
1209
1210
- The un- layered declarations on the <{audio}> element take precedence
1211
- over the explicitly layered declarations on ''audio[controls]'' --
1212
- even though the un-layered styles have a lower specificity,
1213
- and come first in the source order.
1210
+ The explicitly layered declarations on <code> .padding-small </code> take precedence
1211
+ over the un- layered declarations on the <code> .card > .content </code> element --
1212
+ even though the un-layered styles have a higher specificity,
1213
+ and come later in the source order.
1214
1214
</div>
1215
1215
1216
1216
<h4 id="layer-declaration">
@@ -1421,7 +1421,7 @@ Layer Ordering</h4>
1421
1421
Cascade layers are sorted
1422
1422
by the order in which they first are declared,
1423
1423
with nested layers grouped within their parent layers
1424
- before any unlayered rules.
1424
+ after any unlayered rules.
1425
1425
1426
1426
<div class="example">
1427
1427
Given the following layer rules:
@@ -1442,22 +1442,30 @@ Layer Ordering</h4>
1442
1442
h1, h2 { color: maroon; }
1443
1443
}
1444
1444
}
1445
+
1446
+ /* unlayered styles come first in the layer order */
1447
+ h1 { color: darkslateblue; }
1445
1448
</pre>
1446
1449
1447
- The outer layers are sorted first:
1450
+ The outer layers are sorted first,
1451
+ with any unlayered style rules
1452
+ added to an implicit outer layer which
1453
+ has lower priority (comes before) the explicit layers:
1448
1454
1449
- 1. ''framework''
1450
- 2. ''utilities''
1455
+ 1. (implicit outer layer)
1456
+ 2. ''framework''
1457
+ 3. ''utilities''
1451
1458
1452
1459
Within each layer,
1453
1460
nested layers are sorted in appearance order,
1454
1461
and style rules without further nesting
1455
- are added to an implicit sub-layer which
1456
- takes priority over (comes after) explicitly nested layers:
1462
+ are similarly added to an implicit sub-layer
1463
+ before the explicitly nested layers:
1457
1464
1458
- 1. ''framework.default''
1459
- 2. ''framework.theme''
1460
- 3. ''framework'' (implicit sub-layer)
1465
+ 1. (implicit outer layer)
1466
+ 2. ''framework'' (implicit sub-layer)
1467
+ 2. ''framework.default''
1468
+ 3. ''framework.theme''
1461
1469
4. ''utilities''
1462
1470
</div>
1463
1471
@@ -1466,6 +1474,8 @@ Layer Ordering</h4>
1466
1474
on the order of identically-named layers in the shadow DOM
1467
1475
(and vice versa).
1468
1476
1477
+ Issue(6323): Allow authors to explicitly place unlayered styles in the layer order
1478
+
1469
1479
<h4 id="at-layer">
1470
1480
Declaring Layers Inline: the ''@layer'' rule</h4>
1471
1481
@@ -1742,6 +1752,8 @@ Changes</h2>
1742
1752
(<a href="https://github.com/w3c/csswg-drafts/issues/5681">Issue 5681</a> )
1743
1753
* Added ''revert-layer'' keyword.
1744
1754
(<a href="https://github.com/w3c/csswg-drafts/issues/5793">Issue 5793</a> )
1755
+ * Switched the ordering of unlayered styles
1756
+ from highest to lowest priority in the normal origins.
1745
1757
1746
1758
<h3 id="additions-l4">
1747
1759
Additions Since Level 4</h3>
0 commit comments