Answer the question
In order to leave comments, you need to log in
BEM, block or element?
Hello! I comprehend BEM and the question arose, when is a block and when is an element?
For example, there is a page on which there is a specific footer... this footer will be only on this page and nowhere else, and there is also a footer that is common to everyone.
Is it right to make a page-specific footer an element...
//специфический footer для страницы
.home-page__footer{}
.home-page__footer-content{}
.home-page__footer-item{}
//mod
.home-page__footer-item_left{}
.home-page__footer-item_right{}
.footer{}
.footer__content{}
.footer__item{}
Answer the question
In order to leave comments, you need to log in
The block makes sense regardless of the context. The footer only makes sense as a page element. Plus, the footer almost always has some characteristics that determine its position: position, margin... etc. That immediately characterizes it as an element.
But this is if we consider it as part of one project. And if you look wider, then the same footer structure can be used in different projects. For a page, this is an element, but in general it can be a block.
So I think it's like this:
At the same time, the page__footer class should be given styles that determine its position on the page, and the footer class - everything else.
If the footer is different on one page, then it should be redefined through a modifier. If there are differences in position, then the element should be modified: page__footer_modificator , if there are differences in design, modify the block: footer_modificator
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question