File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -304,6 +304,30 @@ Direct Nesting {#direct}
304
304
*/
305
305
</pre>
306
306
307
+ Note:
308
+ <a href="https://en.wikipedia.org/wiki/CSS#:~:text=bem%20(block%2C%20element%2C%20modifier)">BEM</a> authors often use preprocessors to
309
+ stay <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">dry</a>
310
+ within a file and selector context,
311
+ and preprocessors would concatenate the selectors like strings.
312
+ This however is not how it works in browsers. Authors may still practice BEM,
313
+ but the nested selector string building technique will need to stay a feature
314
+ of preprocessors.
315
+
316
+ For example:
317
+
318
+ <pre class=lang-css>
319
+ .foo {
320
+ color: blue;
321
+ &__bar { padding: 2ch; }
322
+ }
323
+ /* equivalent to
324
+ .foo { color: blue; }
325
+ __bar.foo { padding: 2ch; }
326
+ */
327
+ </pre>
328
+
329
+ ''__bar'' is a valid potential <a href="https://html.spec.whatwg.org/multipage/custom-elements.html">custom element</a> .
330
+
307
331
But the following are invalid:
308
332
309
333
<pre class=lang-css>
You can’t perform that action at this time.
0 commit comments