specifications - Compliance with BEM specifications
问题描述
Does this code violate the BEM specification or is it a "mix?
<button class="corp-info__button-read-more button">Read More</button>
It's the class button that interests me.
解决方案
In principle it's not a problem. However:
You might want to place the button class (it seems to define the more general styles) first and corp-info__button-read-more second (seem to represent the more specific styles).
Always order bem classes from general to specific in your class attribute.
Also maybe you want (although it's advice you didn't ask for) to distinguish between corp-info__button and a respective modifier corp-info__button--read-more.
In orthodox BEM a single dash has no semantic meaning, therefore --read-more is simply a modifier name.
推荐阅读
- python - (Numpy C API)迭代单个数组:NpyIter 与 for 循环(使用 PyArray_DATA)
- ruby-on-rails - 如何在 Rails 5 中验证相同操作的不同 ActiveRecord
- javascript - 反斜杠拆分合并拆分元素
- java - 使用 Jackson 将 XML 转换为 Map,Key 应为小写
- c++ - Poco DateTimeFormatter - 使用当前时区打印时间戳
- css - CSS 直接后代在生产构建中无法正常工作
- django - 获取 http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz 总是失败
- html - 在多行文本下绝对定位一行
- java - JanusGraph 地理索引
- android - Android MVP - 处理 onActivityResult 的正确方法是什么?