html - 可以将多个 BEM 元素应用于 html 元素的类吗?

标签 html css bem

我正在根据 BEM convention 在我的 Web 应用程序中构建 CSS .

我有一个名为 item 的块和 3 个元素:item__section , item__titleitem__description .

我使用这些 BEM 类如下:

<div class="item">
  <div class="item__section item__title"> ... </div>
  <div class="item__section item__description"> ... </div>
</div>
item__section元素类包含我们在元素之间重用的样式。

这是有效的 BEM 还是我应该为 item__section 创建一个修饰符对于每种部分(标题和描述)?

最佳答案

关于html - 可以将多个 BEM 元素应用于 html 元素的类吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47073839/

相关文章:

css - 与 BEM 修改器混淆

javascript - 使用javascript来增加分数

java - 借助 URL 在本地浏览器中显示来自服务器的 .log 内容

html - 居中对齐 div 内容的正确方法

css - 如何从父级扩展 scss(在 BEVM 的情况下)

html - 为什么设置 div class font-size 没有设置 p 元素的字体大小?

html - CSS- float 权利不起作用

html - 让我的搜索框显示在正确的位置

html - CSS 选择器仅将样式应用于父链接

html - 根据类名包含隐藏DIV