what to do if there are many elements for example of the same color and you want to impose on BEM, can there be for example a class .red which will give the red elements a color, or will you still have to write a modifier for each element?
|
1 answer
BEM lacks the concept of global modifiers, since the name of any modifier contains the name of a block or element. But! If you want to move a CSS property outside of one block and apply it to different BEM entities in a project, you need to create a separate block.
Therefore, in BEM, in order to uniformly format a whole set of HTML elements, mixes are used.
For example:
HTML-реализация: <article class="article text">...</article> <footer class="footer"> <div class="copyright text">...</div> </footer> CSS-реализация: .text { font-family: Arial, sans-serif; font-size: 14px; color: #000; } From the documentation:
https://ru.bem.info/methodology/key-concepts/#%D0%9C%D0%B8%D0%BA%D1%81
|