这些名称在BEM方法论下是否正确?
<div class="container">
<div class="container__button-row--1">
<div class="button-row__button--first"></div>
<div class="button-row__button"></div>
<div class="button-row__button"></div>
...
<div class="button-row__button--last"></div>
</div>
<div class="container__button-row--2">
...
</div>
</div>
答案 0 :(得分:1)
鉴于您的问题中的示例代码,我建议以下内容。但我还要指出,container
对于组件/块来说是个坏名字,因为它确实很笼统,并不表示该块的用途。
对于修饰符,您应在class属性中同时使用元素和修饰符,例如block__element block__element--modifier
<div class="container">
<div class="container__button-row container__button-row--1">
<div class="container__button container__button--first"></div>
<div class="container__button"></div>
<div class="container__button"></div>
...
<div class="container__button container__button--last"></div>
</div>
<div class="container__button-row container__button-row--2">
...
</div>
</div>