Which is the correct way to write per BEM methodology for the following markup:
HTML:
<div class="col-sm-12 header">
<div class="logo">
<img class="logo__img" src="images/logo.png" />
</div>
</div>
CSS:
header {}
logo{}
logo__img{}
Or:
HTML:
<div class="col-sm-12 header">
<div class="header__logo">
<img class="logo__img" src="images/logo.png" />
</div>
</div>
CSS:
header {}
header__logo{}
logo__img{}
You have two blocks:
headerandlogo.Logohas an element -image. Basic structure is:At first you should decide is wrapping div is really needed? Maybe you can just write:
Anyway.
If
logoinheaderhas some custom styles, for example margins or different sizes, you should add modificatorlogo_modificatorto customise logo inheader.What's more I recommend you to separate
colandheader.