Answer the question
In order to leave comments, you need to log in
BEM - How to correctly inherit an element of a child block?
There is a "user" block with a "user_avatar" element.
<div class="user">
<img class="user__avatar" src="/public/images/avatars/1.jpg">
</div>
<header>
<header class="header">
<div class="user header__user">
<img class="user__avatar" src="/public/images/avatars/1.jpg">
</div>
</header>
Answer the question
In order to leave comments, you need to log in
If possible, use a modifier for the child element of the user block.
If you are going to significantly change the properties of a block, create a new block. In order not to be trapped by the code in the future.
You can make a call directly to the image block (yes, the image must also be a block in this case. Atomicity etit it), or just to the image.
In general, the first option is preferable. Since the rest I can safely lead to the wrong place. Although the first one will result in code being added everywhere.
And your question is in the documentation here, in the heading “ whatever you want, so fuck ... ” (Anchors are not plowed on the site, so just look at what is in the address bar and turn it up).
However, in general, this is usually not necessary. It's tough to mix like that. This is the principle of BEM, "shake it, don't mix it."
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question