V
V
vasya0922021-06-22 14:04:26
css
vasya092, 2021-06-22 14:04:26

How to correctly write a common modifier for BEM blocks?

Hello, at the moment I'm trying to apply BEM in projects. There is a simple block layout shown below. Can I add a class to block-1 and block-2, such as fullwidth, which is common to some of the blocks on the site, to add multiple styles to multiple different blocks? Or does bam not allow this and should I use a modifier for both blocks block-1_fullwidth and block-2_fullwidth?:

<div class="block-1">
   <div class="block-1__element"></div>
   <div class="block-1__element"></div>
</div>
<div class="block-2">
   <div class="block-2__element"></div>
   <div class="block-2__element"></div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Volkov, 2021-06-22
@GovnoKoder_ITS

An entity that defines the appearance, state, or behavior of a block or element.

So, yes you can
Words are separated from each other by one underscore.
https://en.bem.info/methodology/quick-start/#Modify...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question