A
A
Alexey Nikolaev2017-09-28 15:32:48
css
Alexey Nikolaev, 2017-09-28 15:32:48

What is the best way to do it within BEM?

Good day.
There is the same block that needs to be styled a little differently depending on where it is located - in the sidebar or in the middle of the content. How to do it right? By creating a modifier for each of the options (.block_type_sidebar, etc.), or still making the block style dependent on another block (.selector .block)? The manual says that the second option is possible, but not recommended, but the first seems redundant to me.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
i, 2017-09-28
@Heian

...styled a little differently...

This can mean very different things, the possible options are:
In general, if the variability is limited and is required in different places, it is more appropriate to implement it with a modifier.
The use of mixes is appropriate when it is necessary to combine implementations and their variations.
Additionally:
PS Add your case to the options in the comments, I will supplement the answer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question