Despite my experience with CSS and its pre-processors, I still lack confidence in fully embracing the Block Element Modifier (BEM) convention.
Suppose we adhere to this specific BEM format:
block-name__element-name_modifier-name_modifier-value
I am curious if it is acceptable to define a class without the element-name
, featuring only the block followed by the modifier.
For instance:
<div class="menu_light-theme">
<!-- other menu elements like buttons and icons -->
<ul class="menu__list_light-theme>
<li><a class="menu__list-element" href="">Home</a></li>
<li><a class="menu__list-element" href="">About</a></li>
</ul>
</div>
In the code snippet above, the .menu_light-theme
class serves as a 'wrapper' for the menu, containing only the block and modifier.
While I acknowledge that preferences may vary, I am interested in whether this aligns with BEM principles and welcome suggestions on handling scenarios where the element component of BEM might seem unnecessary.