bem-site / bem-forum-content-en

Content BEM forum for English speak users
3 stars 0 forks source link

Correct way of nesting blocks inside a block #74

Open avxkim opened 6 years ago

avxkim commented 6 years ago

Here's example:

<div class="rate-calc">
  <div class="rate-calc__internet internet">
    <div class="internet__title">Some title</div>
    <div class="internet__text">Lorem ipsum dolar sit amet</div>
  </div>
</div>

Is it correct BEM usage? Nesting block in a block still seems unclear for me.

tadatuta commented 6 years ago

@heihachi88 Yes, that's the right way.

avxkim commented 6 years ago

@tadatuta thanks, rate-calc__internet means that i can't reuse that block anywhere, but only inside rate-calc, right?

Also why some people using a single dash instead of underscore, when referring to an modificator, e.g.: rate-calc__internet-active, shouldn't it be like so: rate-calc__internet_active?

tadatuta commented 6 years ago

rate-calc__internet means that i can't reuse that block anywhere, but only inside rate-calc

yes

why some people using a single dash instead of underscore

There are few different naming conventions and all of them are valid. See https://en.bem.info/methodology/naming-convention/#alternative-naming-schemes

ghost commented 6 years ago
<nav class="navbar">
  <ul class="navbar__menu menu">
    <li class="menu__item"><a class="?" href="#"> BEM <a></li>
  </ul>
</nav>

my question is:

<a class="menu__link">

or

<li class="menu__item item"><a class="item__link">

i think which "item" class only is to do a block to "link" and has no some other use...