K
K
KG2016-02-21 13:11:33
css
KG, 2016-02-21 13:11:33

How to correctly name classes according to Bam?

Hello. There is the following structure:
.sidebar>.sidebar__page-header> and further in this element there is a logo block inside which there are 3 more elements. Since there is no element element in Bam, there is probably an element block, which is the logo block relative to .sidebar__page-header. What is the correct way to designate this structure according to Bam?
.sidebar_page-header-logo? And inside .sidebar__page-header-logo__img? Am I thinking right? Or is it easier to use the cascade once, make .sidebar .page-header__logo?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2016-02-21
Protko @Fesor

there is an element block

There is nothing like that. There are only blocks, elements and modifiers.
<div class="sidebar">
    <div class="sidebar__page-header-logo logo">
        <div class="logo__img"></div>
        <div class="logo__element2"></div>
        <div class="logo__element3"></div>
    </div>
</div>

or if someone (like me) likes jade:
.sidebar
    .sidebar__page-header-logo.logo
        .logo__img
        .logo__element2
        .logo__element3

everything is very simple. Each block is, if possible, independent (sometimes it is simply not profitable to abandon the cascade completely). It defines the base styles. And the elements are responsible for the positioning of the blocks.

N
name surname, 2016-02-21
@symbol

there is also a video report on this topic

D
Denis T, 2016-02-21
@tyukavin_denis

frontender.info/MindBEMding
times article.
frontender.info/learning-to-love-bem
two article.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question