F
F
freeman02042016-09-28 14:21:02
HTML
freeman0204, 2016-09-28 14:21:02

Am I naming the BEM classes correctly?

Am I naming the BEM classes correctly?

<header>
    <div class="wrapper">
           <div class="header__topblock clearfix">
                 <div class="header__topblock__logo">
                    <a href=""><img src="img/header__topblock__logo.png" alt=""></a>
                    <p class="header__topblock__slogan">текст»</p>
                </div>
                
                <div class="header__topblock__searchform">
                    <form action="" class="searchform">
                        <input type="text" placeholder="Введите название или артикул">
                    </form>
                </div>
                
                <div class="header__topblock__contacts">
                    <a href="tel:54545" class="header__topblock__contacts__tel">54545</a>
                    
                </div>       
            </div>
    </div>
  </header>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Leonid Knyazev, 2016-09-28
@freeman0204

No, because you get element_elements.
You can read:
Naming convention
Why it is not recommended to create elements in BEM e...
In your case, it would look like this:

<header>
    <div class="wrapper">
        <div class="header-topblock clearfix">
            <div class="header-topblock__logo">
                <p class="header-topblock__slogan">текст»</p>
            </div>
                
            <div class="header-topblock__searchform"></div>
                
            <div class="header-topblock__contacts">
                <a href="tel:54545" class="header-topblock__contacts_tel">54545</a>
            </div>       
        </div>
    </div>
</header>

Block:
header-topblock
Elements:
header-topblock__logo
header-topblock__searchform
header-topblock__contacts
Element with
header-topblock__contacts_tel modifier

A
Andrey Verkh, 2016-09-28
@sadisme

No. If you read the documentation at least once, you yourself would see why

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question