Skip to content

Commit 8824582

Browse files
committed
[css-cascade-5] Clarify the behavior of nested layer shorthand
1 parent 6812bd9 commit 8824582

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

css-cascade-5/Overview.bs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,43 @@ Nested Layers</h5>
12451245
</pre>
12461246
</div>
12471247

1248+
This syntax is provided as a shorthand for defining nested layers,
1249+
and has the same effect as declaring each [=layer name=]
1250+
inside nested ''@layer'' rules.
1251+
1252+
<div class="example">
1253+
That means the shorthand syntax can also be used in defining new layers,
1254+
and establishing layer order.
1255+
1256+
The following example defines <css>framework.theme</css> before <css>framework.default</css>:
1257+
1258+
<pre class='lang-css'>
1259+
@layer framework.theme {
1260+
blockquote { color: rebeccapurple; }
1261+
}
1262+
1263+
@layer framework {
1264+
@layer default {
1265+
p { margin-block: 0.75em; }
1266+
}
1267+
1268+
@layer theme {
1269+
p { color: #222; }
1270+
}
1271+
}
1272+
</pre>
1273+
1274+
The <css>framework.theme</css> shorthand is purely syntax sugar for the following longhand:
1275+
1276+
<pre class='lang-css'>
1277+
@layer framework {
1278+
@layer theme {
1279+
blockquote { color: rebeccapurple; }
1280+
}
1281+
}
1282+
</pre>
1283+
</div>
1284+
12481285
Issue(w3c/csswg-drafts#5791): What is the appropriate syntax for appending to nested layers?
12491286

12501287
<h5 id="unnamed-layers" class="no-toc">

0 commit comments

Comments
 (0)