M
M
Maloy1232017-04-11 15:34:13
css
Maloy123, 2017-04-11 15:34:13

BEM how to avoid class conflicts?

BEM seems to solve this problem, but I seem to misunderstand something.
Let's say we have a list of products

<div class="products">
    <div class="product">
        <div class="product__title">Заголовок продукта</div>
        <div class="product__description">Описание продукта</div>
        <div class="product__btns product-btns">
            <button class="product-btns__btn-buy">Купить</button>
        </div>
    </div>
</div>

And there is a separate item
<div class="product">
    <div class="product__title">Заголовок продукта</div>
    <div class="product__description">Описание продукта</div>
    <div class="product__btns product-btns">
        <button class="product-btns__btn-buy">Купить</button>
    </div>
</div>

Product blocks should be radically different from each other, despite the fact that they have the same structure. How to be in such a situation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-04-11
@Maloy123

Product blocks should be radically different from each other, despite the fact that they have the same structure. How to be in such a situation?

It's just that these are two different blocks, if there is nothing in common between them except for the structure. The list will contain an array of .product-card blocks, on the product page the .product block, of course, you can make any names, to your liking.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question