A
A
asdasdqwe2022-04-15 16:53:06
BEM
asdasdqwe, 2022-04-15 16:53:06

Why set a class for everything?

First option

<nav class="navbar">
   <ul class="navbar__list">
        <li class="navbar__item">
              <a class="navbar__link" href="#">About</a>
         </li>
    </ul>
</nav>


Second option
<nav class="navbar">
     <ul>
           <li>
              <a href="#">About</a>
            </li>
      </ul>
</nav>


Why, according to the BEM principle, it is necessary to specify a class for all elements, but we can style it just like this:

.navbar ul li a {
   color: #fff;
}


Instead of
.navbar__link {
   color: #fff;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question