5

Let's say I have to define a header block in BEM. Headers need some indentation (padding, margins), but it's also a common understanding that layout should stay separated from components.

The question is, should I specify indentation as a part of my header block CSS, or should it only be provided by surrounding blocks (layout blocks or grid)? Both approaches have their cons and pros.

2 Answers2

2

You can mix few blocks (or block and element of some other block) on the same DOM-node.

E.g. <div class="header layout__header">.

tadatuta
  • 2,007
  • 11
  • 12
  • I used such a method in my blog http://varya.me/. You can see in the source the 'island' block, not pure layout but somehow responsible for that. Then, its elements can be mixed with other blocks.
    ...
    – Varvara Stepanova Jul 16 '13 at 16:27
0

it will be better if you specify indentation to header block, because you will need less work to do and will maintain consistency.

Manoj Meena
  • 244
  • 1
  • 5