A
A
Aristotel Paskalov2021-03-01 23:34:00
BEM
Aristotel Paskalov, 2021-03-01 23:34:00

What is the correct way to set classes according to BEM?

Can you please tell me how to correctly set classes according to BEM, in the first option, or the second one?

1 option:

<header class="header">
    <div class="container">
        <div class="header__body">
            <img src="" alt="" class="header__logotype">

            <nav class="header__nav">
                <ul class="header__list">
                    <li class="header__item"><a href="" class="header__link"></a></li>
                    <li class="header__item"><a href="" class="header__link"></a></li>
                    <li class="header__item"><a href="" class="header__link"></a></li>
                </ul>
            </nav>
        </div>
    </div>
</header>


Option 2:
<header class="header">
    <div class="container">
        <div class="header-body">
            <img src="" alt="" class="header-body__logotype">

            <nav class="header-body__nav nav-body">
                <ul class="nav-body__list">
                    <li class="nav-body__item"><a href="" class="nav-body__link"></a></li>
                    <li class="nav-body__item"><a href="" class="nav-body__link"></a></li>
                    <li class="nav-body__item"><a href="" class="nav-body__link"></a></li>
                </ul>
            </nav>
        </div>
    </div>
</header>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Ineshin, 2021-03-02
@IonDen

2 is preferred. Since navigation is taken out in a separate entity.
In option 1, header__list and header__item - it's not at all clear what. How to understand what is the menu? Names also need to carry meaning.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question