Answer the question
In order to leave comments, you need to log in
What is the best thing to do at such moments by bem?
For example, there is such a block with elements:
<div class="some-class">
<div class="some-class__close">
<svg class="some-class__close-icon"></svg>
</div>
<div class="some-class__card">
<div class="some-class__card-picture"></div>
<div class="some-class__card-title"></div>
<div class="some-class__card-desc"></div>
<div class="some-class__card-btn"></div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
This markup is absolutely correct in two cases:
1) Your `close` and `card` are really not reused anywhere;
2) The scope of the styles of the `some-class` block remains adequate for perception.
Accordingly, you need a new block in two cases: either it is reused, or to separate the code for ease of perception.
Let's take a more complicated markup (no need to look for any meaning in it, just typed something from the lantern for illustration):
<div class="block">
<!-- Header -->
<div class="block__header">
<h2 class="block__title">Title</h2>
<div class="block__actions">
<button type="button" class="block__action block__action--edit">
<span class="block__action-icon"></span>
</button>
</div>
</div>
<!-- Content -->
<div class="block__content">
<p>...</p>
</div>
<!-- Footer -->
<div class="block__footer">
<div class="block__about">
<div class="block__author"></div>
<div class="block__date"></div>
</div>
<div class="block__awards">
<div class="block__award">
<div class="block__award-inner"></div>
<div class="block__award-tooltip">
<div class="block__award-tooltip-content"></div>
<button type="button" class="block__award-tooltip-close"></button>
</div>
</div>
</div>
</div>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question