S
S
sleepy_hungry2019-11-02 12:55:40
HTML
sleepy_hungry, 2019-11-02 12:55:40

BEM: is it possible to use the Block_Modifier class without using the Block class?

Good afternoon. I'm learning BEM. The layout has a section that has the following structure:

<section class="offer-screen"> 
  <div class="container">
    <div class="offer d-flex">
      <div class="stimul">
        <p class="stimul__workshop"><i class="fa fa-graduation-cap"></i>Онлайн-мастер-класс</p>
        <h2 class="stimul__title">Не потеряйте уникальную возможность. Бронируйте участие уже сегодня!</h2>
        <p class="stimul__time"><i class="fa fa-clock"></i>9 апреля в 18:00<i class="fa fa-users"></i>Всего 40 мест</p>
      </div>

In the same layout, there is another section that is similar in essence and structure to it, but still has differences. I used the existing structure, writing modifiers, but removing the main class name. Question: is it possible to do this?
<section class="offer-screen_blue> 
  <div class="container">
    <div class="offer_blue d-flex">
      <div class="stimul_blue">
        <p class="stimul__workshop"><i class="fa fa-graduation-cap"></i>Онлайн-мастер-класс</p>
        <h2 class="stimul__title_blue">Не потеряйте уникальную возможность. Бронируйте участие уже сегодня!</h2>
        <p class="stimul__time_blue"><i class="fa fa-clock"></i>9 апреля в 18:00<i class="fa fa-users"></i>Всего 40 мест</p>
      </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2019-11-02
@sleepy_hungry

NO.
You can style like this

.block {} /* без стилей */
.block_green { color: green; }
.block_red { color: red; }

But you still have to write a block AND a modifier in the markup
<div class"block block_green">
</div>

It is clear that technically it will work without specifying a block. But if you stick to BEM, you must specify the block.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question