Answer the question
In order to leave comments, you need to log in
How to implement two blocks of the same style according to BEM?
There are two independent blocks: services and benefits. In terms of styling, they are all the same. The only thing that distinguishes them from each other is the content. How to implement them in this case according to BEM?
1. Leave everything as it is, and set both blocks to the same styles (duplicate).
.services {
/* Стили */
}
.advantages {
/* Стили */
}
<section class="services">
<h2 class="heading">Услуги</h2>
<ul class="services__list">
<li>Услуга 1</li>
<li>Услуга 2</li>
<li>Услуга 3</li>
</ul>
</section>
<section class="advantages">
<h2 class="heading">Преимущества</h2>
<ul class="advantages__list">
<li>Преимущество 1</li>
<li>Преимущество 2</li>
<li>Преимущество 3</li>
</ul>
</section>
.section{
/* Стили */
}
<section class="section">
<h2 class="heading">Услуги</h2>
<ul class="section__list">
<li>Услуга 1</li>
<li>Услуга 2</li>
<li>Услуга 3</li>
</ul>
</section>
<section class="section">
<h2 class="heading">Преимущества</h2>
<ul class="section__list">
<li>Преимущество 1</li>
<li>Преимущество 2</li>
<li>Преимущество 3</li>
</ul>
</section>
Answer the question
In order to leave comments, you need to log in
What if:
.section{
/* Стили общие */
}
.services {
/* Стили свои */
}
.advantages {
/* Стили свои */
}
<section class="section services">
<h2 class="heading">Услуги</h2>
<ul class="services__list">
<li>Услуга 1</li>
<li>Услуга 2</li>
<li>Услуга 3</li>
</ul>
</section>
<section class="section advantages">
<h2 class="heading">Преимущества</h2>
<ul class="advantages__list">
<li>Преимущество 1</li>
<li>Преимущество 2</li>
<li>Преимущество 3</li>
</ul>
</section>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question