首先使用 BEM。我做错了什么?

First use BEM. What I doing wrong?

我第一次尝试使用BEM,但我认为我不太了解它。 是否一定要给所有元素赋值类,包括lia?如果能收到您对代码和平的建议,我将不胜感激:

  <header>
<div class="container container-1170">
  <div class="row">
    <div class="col-md-12">

      <nav class="navbar navbar-default header-menu">

        <div class="navbar-header header-menu__toggle">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <img src="./img/sprite.png" class="header-menu__logo ico_header-logo" alt="">
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right header-menu__list">
            <li class="header-menu__list__item item"><a href="#" class="item__href item__href--active"></a></li>
            <li class="dropdown header-menu__list__item item">
              <a href="#" class="dropdown-toggle item__href item__href--dropdown" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
              <ul class="dropdown-menu drop-list">
                <li class="drop-list__item"><a href="#"></a>
                  <ul class="in-drop-item">
                    <li class="in-drop-item__item"><a href="#" class="in-drop-item__item__href"></a></li>
                    <li class="in-drop-item__item"><a href="#" class="in-drop-item__item__href"></a></li>
                    <li class="in-drop-item__item"><a href="#" class="in-drop-item__item__href"></a></li>
                    <li class="in-drop-item__item"><a href="#" class="in-drop-item__item__href"></a></li>
                    <li class="in-drop-item__item"><a href="#" class="in-drop-item__item__href"></a></li>
                    <li class="in-drop-item__item"><a href="#" class="in-drop-item__item__href"></a></li>
                  </ul>
                </li>
                <li class="drop-list__item"><a href="#"></a></li>
                <li class="drop-list__item"><a href="#"></a></li>  
                <li class="drop-list__item"><a href="#"></a></li>
              </ul>
            </li>
            <li class="header-menu__list__item item"><a href="#" class="item__href"></a></li>
            <li class="header-menu__list__item item"><a href="#" class="item__href"></a></li>
            <li class="header-menu__list__item item"><a href="#" class="item__href"></a></li>
            <li class="header-menu__list__item item"><a href="#" class="item__href"></a></li>
            <li class="header-menu__list__item item"><a href="#" class="item__href"></a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </nav>
    </div>
  </div>
</div>

感谢您的帮助!

bem 的关键概念是代码的可重用性。如果你能重用,你应该给它一个class。它有助于避免嵌套选择器并使事情更加模块化。我强烈建议不要这样做,如果没有必要,但如果你觉得这个元素永远不会从这个结构中分离出来,你可以为它们制定一些级联样式规则,但要小心,这种感觉通常很棘手。

此外,我还发现了一些其他错误 - 你应该避免 "elements of elements"。这是解释: https://en.bem.info/methodology/faq/#why-does-bem-not-recommend-using-elements-within-elements-block__elem1__elem2