W
W
wakenbyWork2021-05-25 13:19:14
BEM
wakenbyWork, 2021-05-25 13:19:14

Is it possible to nest elements of one block in another?

Is it possible to write bem like this?:

1)

<div class="l-about">
    <div class="l-about__inner">
        <div class="l-about__left">

            <div class="history">
                <h1 class="l-about__title">Большой заголовок</h1>

                <div class="history__timer"></div>
                <div class="history__banner"></div>

                <div class="l-about__section">
                    <h4 class="l-about__sub-title">Заголовок по меньше</h4>
                    <p class="l-about__text">Текст</p>
                </div>
            </div>

        </div>

        <div class="l-about__right">
            <div class="about-sidebar"><!-- code --></div>
        </div>
    </div>
</div>


2)

<div class="l-about">
    <div class="l-about__inner">
        <div class="l-about__left">

            <div class="history shared-about-elements">
                <h1 class="shared-about-elements__title">Большой заголовок</h1>

                <div class="history__timer"></div>
                <div class="history__banner"></div>

                <div class="shared-about-elements__section">
                    <h4 class="shared-about-elements__sub-title">Заголовок по меньше</h4>
                    <p class="shared-about-elements__text">Текст</p>
                </div>
            </div>

        </div>

        <div class="l-about__right">
            <div class="about-sidebar"><!-- code --></div>
        </div>
    </div>
</div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
webvalery, 2022-01-19
@webvalery

No.
Quote from the documentation:
"Element A
component of a block that cannot be used in isolation from it. Elements do not exist outside the block. Each element can belong to only one block."

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question