我知道在使用 BEM 时,类名不应该直接反映 HTML 结构,但是应该如何命名包装器元素?请忽略我的特殊语法(接近SUIT);它仍然遵循 BEM,只是采用了不同的方式来区分元素。
例如:
<div class="?">
<footer class="PageFooter">
<h4 class="PageFooter-brand>…</h4>
<ul class="PageFooter-contactDetails">…</ul>
</footer>
<div>
我目前将这个实例中的包装器归类为PageFooterWrapper
,但这感觉很笨拙,因为包装器不是独立的 - 它纯粹是为PageFooter
. 显然,在所有内容前加上前缀PageFooter-
是荒谬的,因此只能将包装器视为 : 的PageFooter
一部分PageFooter-wrapper
。这让我很恼火,因为这有一个隐含的建议。
那么包装器的类应该是什么?