E
E
eugenedrvnk2020-05-08 21:04:45
css
eugenedrvnk, 2020-05-08 21:04:45

How to build a structure according to BEM?

In one video I saw the following example:

<section class="section-header">
  <div class="section-inner">
    <div class="section-header-logo"></div>
    <div class="section-header-content">
      <div class="section-header-wrapper">
        <div class="section-header-wrapper__title"></div>
        <div class="section-header-wrapper__subtitle"></div>
      </div>
    </div>
  </div>
</section>


There are many blocks here, and only starting from the header-wrapper block do the elements appear - section-header-wrapper__title and section-header-wrapper__subtitle. Is this approach correct? Or, logically, the entire section-header should go as the main block, and the rest of the divs as its elements.

<section class="section-header">
  <div class="section-header__inner">
    <div class="section-header__logo"></div>
    <div class="section-header__content">
      <div class="section-header__wrapper">
        <div class="section-header__wrapper-title"></div>
        <div class="section-header__wrapper-subtitle"></div>
      </div>
    </div>
  </div>
</section>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xdevelx, 2020-05-08
@develx

There is more to be said here

<header class="header">
  <div class="header__inner">
    <div class="header__logo"></div>
    <nav class="header__nav"></nav>
  </div>
</header>
<section class="intro">
  <div class="intro__wrapper">
    <h1 class="intro__title"></h1>
    <div class="intro__subtitle"></div>
  </div>
</section>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question