S
S
SagePtr2017-07-29 11:26:55
BEM
SagePtr, 2017-07-29 11:26:55

BEM and a block within a block?

Am I following the correct structure for nesting a block inside a block? (let's call them outer and inner for clarity)
HTML:

<div class='outer'>
    ... тут другие элементы, входящие в блок outer
    <div class='outer__inner inner'>
      ... тут элементы, входящие в блок inner
    </div>
    ... тут другие элементы, входящие в блок outer
</div>

CSS:
.outer {
    тут правила блока outer;
}
.outer__inner {
    тут правила блока inner, влияющие на его расположение внутри родительского блока (margin, flex);
}
.inner {
    а тут правила, влияющие на оформление самого блока inner, не зависящие от родителя;
}

Or am I overcomplicating something?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-07-29
@SagePtr

Or am I overcomplicating something?

No, it's good practice, or you can nest inner in outer__inner , and sometimes you can even do a simple cascade if everything is transparent and do without additional entities.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question