Answer the question
In order to leave comments, you need to log in
What is a BEM entity anyway?
Hello everyone, I have already made a couple of pages using the BEM methodology, but a question arises. For example, I have a BEM entity article that contains a category element, an article title element, and a short text element. But the other page contains a similar entity, also a selection from the category, but this entity already contains only the element title of the article and the picture of the article, that is, they are visually similar, but can this be attributed to the same article entity? Can one entity have some elements and another one? Tell me please
Answer the question
In order to leave comments, you need to log in
Can one entity have some elements and another one?
It's easiest to assume that all elements are "completely independent blocks" (my-article, my-title, my-description, ...). In this case, if block A (for example, my-title) in the context of block B (for example, my-article) needs to be somehow additionally styled, then the class "element of block B" is added to it (for example, my-article-title).
The names must match the semantics. For example, you might have a my-image block that displays an image. But in the context of my-profile, you can have many different pictures, so you need to give them appropriate names: my-profile-photo, my-profile-avatar, and so on.
<div class="my-profile">
<div class="my-image my-profile-photo" />
<div class="my-image my-profile-avatar" />
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question