R
R
rtfm mftr2016-04-01 19:59:10
css
rtfm mftr, 2016-04-01 19:59:10

How to position a Block in BEM?

Did I understand correctly that according to the BEM methodology, a Block cannot contain rules responsible for its positioning? In this case, how to position it? The first way, as I understand it, is to wrap it in an Element and position it, and the second way to add auxiliary classes something like this

<div class='slider float-left margin-top-40 pos-abs top-100'>...

The first one is not liked by the fact that it is necessary to add an extra div and puzzle over what to call it. The second is that it is necessary to produce a bunch of classes that are used once, plus the Block itself has a lot of classes.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-04-01
@rtfmmftr

it's not bam.
Not really "wrapping", it's just that the elements are responsible for positioning, and the blocks set the basic styles.

<!-- у элемента в принципе не обязательно должен быть блок, но желательно -->
<div class="page__wrapper block"> 
    <div class="block__header header"></div>
</div>

Well, the idea is something like this.
It's not BEM at all, it's... well, as with the style attribute, there are only fewer problems, but a lot of duplication.
In general, I recommend that you watch this: WSD in Novosibirsk // BEM - norms, Vadim Makeev

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question