S
S
Sector5672020-07-17 09:55:22
BEM
Sector567, 2020-07-17 09:55:22

Is it possible to leave such code following BEM?

<aside class="aside">
    <div class="aside__logo">
        <div class="img">
            <img src="logo.png" alt="logo" />
        </div>
        <div class="title">Заголовок</div>
        <div class="ico">Иконка</div>
    </div>
</aside>


Is it possible to specify non-BEM classes inside the logo element, as in the example with the img, title, ico classes.
And set the styles by nesting, so that if another img class appears, then they do not conflict?

If not, how is it right? aside__img, aside__title aside__ico ? But they do not refer to the aside, but to the logo. Then create a new logo block in the same place as aside__logo?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Pershin, 2020-07-17
@Sector567

It is not entirely clear what you want to get in the end and what exactly is your logo (a picture or the entire contents of the logo), it is advisable to consider such examples with a layout, and not guess on coffee grounds, but nevertheless, usually a logo is a separate block that can be mix depending on the environment, as an option like this:

<aside class="aside">
    <div class="aside__logo logo">
        <div class="logo__pic">
            <img src="logo.png" alt="logo" class="logo__img" />
        </div>
        <div class="logo__title">Заголовок</div>
        <div class="logo__ico">Иконка</div>
    </div>
</aside>

A
Andrey Vasilev, 2020-07-17
@Nolis

Also as an option:

<aside class="aside">
    <div class="aside-logo">
        <div class="aside-logo__item">
            <img class="aside-logo__img" src="logo.png" alt="logo" />
        </div>
        <div class="aside-logo__title">Заголовок</div>
        <div class="aside-logo__ico">Иконка</div>
    </div>
</aside>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question