0
我想对BEM约定做一些说明。假设我有一个卡块,将在两个地方/页面registration
和dashboard
中使用。BEM:命名约定
卡片HTML结构看起来是这样的:
<div class="card">
<header class="cardheader">
<h3 class="cardheader_title">
Some Title
</h3>
</header>
<section class="card-body">
<!-- this can contain other blocks. -->
<!-- for example a nav and a form. or simple an acticle -->
</section>
</div>
我还想写scss
这一次,然后就可以无论我需要它来使用它。那么让我们以注册页面为例。
<div class="card registration-card">
<header class="cardheader registration-cardheader">
<h3 class="cardheader_title registration-cardheader__title">
Some Title
</h3>
</header>
<section class="card-body registration-cardbody">
<!-- this can contain other blocks. -->
<!-- for example a nav and a form. or simple an acticle -->
</section>
</div>
然后再重复的仪表板相同:
<div class="card dashboard-card">
<header class="cardheader dashboard-cardheader">
<h3 class="cardheader_title dashboard-cardheader__title">
Some Title
</h3>
</header>
<section class="card-body dashboard-cardbody">
<!-- this can contain other blocks. -->
<!-- for example a nav and a form. or simple an acticle -->
</section>
</div>
我只是在上面的例子中block
和block__modifer
工作
是AN acceptable
BEM方法上面?