Skip to content

Commit b4771e1

Browse files
committed
[css-nesting] example nits and updates
1 parent 6fdc24f commit b4771e1

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

css-nesting-1/Overview.bs

+30-16
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,17 @@ Direct Nesting {#direct}
235235
.foo .foo .bar .foo .baz .foo .qux { color: blue; }
236236
*/
237237

238+
.foo {
239+
color: blue;
240+
& { padding: 2ch; }
241+
}
242+
/* equivalent to
243+
.foo {
244+
color: blue;
245+
padding: 2ch;
246+
}
247+
*/
248+
238249
.error, #404 {
239250
&:not(.foo,.bar) > .baz { color: red; }
240251
}
@@ -246,28 +257,31 @@ Direct Nesting {#direct}
246257
&:is(.bar, &.baz) { color: red; }
247258
}
248259
/* equivalent to
249-
.foo:is(.bar, .foo:is(.baz)) { color: red; }
260+
.foo:is(.bar, .foo.baz) { color: red; }
250261
*/
251262

252-
main {
253-
display: grid;
254-
& > section {
255-
background: white;
256-
& > header {
257-
font-size: 1.25rem;
263+
figure {
264+
margin: 0;
265+
266+
& > figcaption {
267+
background: hsl(0 0% 0% / 50%);
268+
269+
& > p {
270+
font-size: .9rem;
258271
}
259272
}
260273
}
261274
/* equivalent to
262-
main { display: grid; }
263-
main > section { background: white; }
264-
main > section > header { font-size: 1.25rem; }
275+
figure { margin: 0; }
276+
figure > figcaption { background: hsl(0 0% 0% / 50%); }
277+
figure > figcaption > p { font-size: .9rem; }
265278
*/
266279

267280
main {
268281
& > section,
269282
& > article {
270283
background: white;
284+
271285
& > header {
272286
font-size: 1.25rem;
273287
}
@@ -296,17 +310,17 @@ Direct Nesting {#direct}
296310

297311
.foo {
298312
color: red;
299-
&.bar, .baz { color: blue; }
313+
&&.bar { color: blue; }
300314
}
301-
/* Invalid because the second selector in the list doesn't
302-
contain a nesting selector. */
315+
/* Invalid because the 1st & is no longer
316+
at the start of a nesting selector */
303317

304318
.foo {
305319
color: red;
306-
&&.bar { color: blue; }
320+
&.bar, .baz { color: blue; }
307321
}
308-
/* Invalid because the 1st & is no longer
309-
at the start of a selector */
322+
/* Invalid because the second selector in the list doesn't
323+
contain a nesting selector. */
310324
</pre>
311325
</div>
312326

0 commit comments

Comments
 (0)