W
W
wakenbyWork2021-11-03 15:59:07
BEM
wakenbyWork, 2021-11-03 15:59:07

Is it possible to just write active in BEM?

I know that you can write like this:

<div class="tab">
  <div class="tab__contetn tab__content--active"></div>
  <div class="tab__contetn"></div>
  <div class="tab__contetn"></div>
</div>


Is it possible to just use active?

<div class="tab">
  <div class="tab__contetn active"></div>
  <div class="tab__contetn"></div>
  <div class="tab__contetn"></div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Shabalin, 2021-11-03
@wakenbyWork

BEM is a fairly flexible methodology, and if your project agrees that `active` can be a global modifier for blocks and elements, you can.
In some projects, such modifiers are separated into `is_`-components: `is_active`, `is_hover`. Again, this is about teamwork. If by the rules, then `
active` is a block , not a modifier. It's just naming that confuses other project participants. You expect one thing, but you get another. At first I would follow the methodology strictly, and then I would modify it for the project and the team.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question