D
D
dmitriyivvvv2018-05-06 12:39:18
Layout
dmitriyivvvv, 2018-05-06 12:39:18

How to correctly name classes according to BEM in this case?

Good afternoon! Completely confused with BEM. There is the following code:

<header class="post__meta">
  <ul class="list list_horizontal">
    <li class="list__item">Опубликовано: <time datetime="" class="post__time">1 день назад</time></li>
    <li class="list__item"></li>
    <li class="list__item"></li>
  </ul>
</header>

That is, there is a universal list block that I use a lot on the page, I need to place post meta data, publication date, author name (post__time, post__author) in it separately in each list__item. But as I understood the entry in the code above
<time datetime="" class="post__time">1 день назад</time>

will not be true. You cannot nest an element from one block within another block. What is the correct way to name classes in this case? I hope I explained clearly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2018-05-06
@dmitriyivvvv

But as I understand it, the entry in the code above will not be correct. You cannot nest an element from one block within another block.

You can, if the list block is inside the post block , BEM has no restrictions on nesting in HTML code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question