V
V
vvanyazz2021-06-08 11:41:46
css
vvanyazz, 2021-06-08 11:41:46

How to make a mix in bam?

Let's say I have a block - main-block, in this block there are main-block__title and main-block__descr elements, and it is for an element in some section that I want to change the positioning, how exactly should I address the element using a mixin of type: . welcome__main-block__title or with: .welcome__main-block .main-block__title? As for me, modifiers are not very suitable here, since you often need to change positioning, so which option is better?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Pershin, 2021-06-08
@vvanyazz

If this positioning needs to be changed in a specific block and will not be repeated again, then you can mix it like this:

<div class="main-block__title welcome__title"></div>

In css, the blocks that are inside should be written higher than the parent block, in this sequence mixes are made easily. If your parent block comes
earlier and the styles need to be redefined, then in your case it would be better to use a modifier.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question