Answer the question
In order to leave comments, you need to log in
And again BEM, official (private block)?
Good afternoon! Again there was a question on BEM. As you know, there are service blocks in it that are not used separately from their parent element, but are not elements because of the complex structure. In my case, it's the events-list block within the events block . Have I understood everything correctly and is my BEM markup correct?
<div class="events">
<h3 class="events__title">Upcoming events</h3>
<ul class="events-list">
<li class="events-list__item">
<a href="#" class="events-list__link">
<div class="events__calendar">
<span class="events__day">5</span><br>
<span class="events__month">May</span>
</div>
<p class="events__details">some random event</p>
</a>
</li>
<li class="events-list__item">
<a href="#" class="events-list__link">
<div class="events__calendar">
<span class="events__day">24</span><br>
<span class="events__month">June</span>
</div>
<p class="events__details">some random event</p>
</a>
</li>
<li class="events-list__item">
<a href="#" class="events-list__link">
<div class="events__calendar">
<span class="events__day">24</span><br>
<span class="events__month">june</span>
</div>
<p class="events__details">some random event</p>
</a>
</li>
</ul>
<a class="btn" href="#">Посмотреть все</a>
</div>
Answer the question
In order to leave comments, you need to log in
Do you "inside" event-list
again have elements from events
? This also violates the main idea of blocks - modularity.
It seems to me that the blocks could be the events themselves ( li
), and the list containing them could be the block element events
. Something like:
<div class="events">
<h3 class="events__title">Upcoming events</h3>
<ul class="events__list">
<li class="event-list-item">
<a href="#" class="event-list-item__link">
<div class="event-list-item__calendar">
<span class="event-list-item__day">5</span><br>
<span class="event-list-item__month">May</span>
</div>
<p class="event-list-item__details">some random event</p>
</a>
</li>
...
</ul>
<a class="events__get-all-btn btn" href="#">Посмотреть все</a>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question