N
N
Norum2021-09-30 23:48:47
css
Norum, 2021-09-30 23:48:47

What is the correct BEM rule to use a repeating element?

If my layout has a repeating logo element in the header and footer (moreover, it is larger in the footer than in the header), is it correct to make each logo separately? I mean for the header and for the footer , or add a logo mix to the header and footer and then resize the image in the footer? That is , the same thing with the menu: in the header and footer the same menu, only a different location and color, what to do? <a lass="header__logo" href="#"></a><a lass="footer__logo" href="#"></a>
<a lass="header__logo logo" href="#"></a>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Pershin, 2021-10-01
@Norum

Both options are acceptable.
The second option is almost always the right one. I usually make a separate logo and my styles with images for the logo are in a separate logo folder, and there, depending on the context, I either mix header__logo footer__logo , or a modifier, for example, for a smaller copy, you can make logo_size_small
And if the logo only applies to a specific block, then you can easily make it an element, in this case one does not interfere with the other in any way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question