A
A
alexander rodin2017-11-05 19:36:44
css
alexander rodin, 2017-11-05 19:36:44

How to indent between blocks in BEM?

For example, I have this piece of code:

<div class="bem-block"></div>
<div class="another-bem-block"></div>

I would like the vertical padding between blocks to be 50px, but the BEM spec says:
The block should not affect its environment, i.e. the block should not be given external geometry (in the form of padding, borders that affect dimensions) and positioning.

What do i do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dom1n1k, 2017-11-05
@dom1n1k

All blocks are simultaneously children of some parent container. Indentation must be specified for classes corresponding to the elements of the parent block. Further, these classes can be screwed either directly to the blocks under discussion, or to intermediate wrapper divs.
Recently answered a similar question:
https://toster.ru/answer?answer_id=1080988#answers...

S
Sasha, 2017-11-05
@userAlexander

lieflowerme is even better to use a separate class for indentation.
this class can either be added to the block or used separately on the wrapper block.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question