F
F
fantazerno2016-09-05 12:47:50
HTML
fantazerno, 2016-09-05 12:47:50

How would it be correct according to BEM?

Good afternoon!
In view of the fact that there are not always good designers and persistent customers (make pixel by pixel, even if everything is crooked)
Given:
- Block
- With the light hand of the designer, the same block in different places of the layout has different margins from 10-40 (conditionally )
Question:
How do you implement the names of modifiers, in particular their naming in similar situations. When the state of the blocks does not change significantly, but naming the modifier in each case leads to a problem.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alex Glebov, 2016-09-05
@SkiperX

The block is not responsible for its positioning, margins are set only for elements.

<div class="block1">
  <div class="block1_child">
    <div class="block2"></div>
  </div>
</div>

E
Eugene, 2016-09-05
@AppFA

You can alternatively make mixins, for example, there are 2 containers and 2 headers:

<div class="container-1">
    <div class="header container-1__header"></div>
</div>

<div class="container-2">
    <div class="header container-2__header"></div>
</div>

Accordingly, hang the styles on the mix. classes: "container-*__header" and don't touch the main block

A
Andrey Verkh, 2016-09-05
@sadisme

<div class="block block--margin20">

<div class="block block--margin10">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question