Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BEM: the separation of blocks from layout

Tags:

css

bem

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.

like image 268
user2587190 Avatar asked Nov 02 '22 18:11

user2587190


1 Answers

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">.

like image 81
tadatuta Avatar answered Nov 11 '22 04:11

tadatuta