Answer the question
In order to leave comments, you need to log in
Who does BEM markup?
Hello. I keep trying to master BEM layout, but I can't find clear answers on several points. Share your experience.
1. Let's say that in 90% of the blocks, the headings have the same styles. Is it worth making a separate class for them, or is it better to write heading styles for each block separately in each block? This can be implemented with a mixin, not difficult, but is it correct? Because css is getting bigger.
2. Centerer. Same question. Should I prescribe or create a container class for each block? It's just that somewhere this centerer will be outside the block
<div class="block container">
</div>
<div class="block">
<div class="block__container container">
</div>
</div>
Answer the question
In order to leave comments, you need to log in
1)
mixins 2) .page__container
3) set .page to it, well, you can also style styles for body
. Font styles in bem are inherited and this is normal
1. Styling H1. Semantically, this is much more correct than attaching classes to tags.
2. Don't be a hostage to methodology. If you have a modifier for different pages and different elements, it is much more convenient to take it out as a separate class. As, in general, and does most of the frameworks.
3. I ask separately, but this is my personal quirk. This makes it easier to tweak each style separately.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question