Take the following structure:
<div class='article article--yellow'>
<div class='article__headline'>...</div>
</div>
<div class='article article--blue'>
<div class='article__headline'>...</div>
</div>
If I need to make article__headline
different for --yellow
from --blue
, should I do a CSS selector like:
.article--yellow .article__headline { ... }
Or, in the practice of minimizing selection-depth, is it valid BEM syntax to change the markup to this:
<div class='article article--yellow'>
<div class='article--yellow__headline'>...</div>
</div>
Because then I could select it using only 1 selector: article--yellow__headline
.
I know that technically it would work, but I can't figure out if this is valid according to BEM methodology or not.