V
V
Vasily2019-09-04 14:15:46
BEM
Vasily, 2019-09-04 14:15:46

How is it correct according to the BEM methodology, here I have a logo and it is in the center of the page with an indent from the top, what should I put in Modifiers?

How is it correct according to the BEM methodology, here I have a logo and it is in the center of the page with an indent from the top, what should I put in Modifiers?
It must be taken into account that this block can be used somewhere else in the project, and there will be other sizes of the logo and other indents. Here, the help of more experienced comrades is needed.

<div class="logo-log-in logo-log-in-size-large logo-log-in_layout">
       <img class="logo-log-in__img" src="img/Logo.svg" alt="Logo Mercury Developers">
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anita Kovaleva, 2019-09-04
@Anitamsk

Everything is done very simply. You have header-block, it contains your logotype.
You make yours logotypea separate element, prescribe common styles for it, without positioning and binding to the structure header-block. As a result:

.header-block ---------------------------> Ваш основной бэм блок
  .header-block__logotype logotype      ------------> где,  header-block__logotype
(вы прописываете позиционирование),  logotype -  у вас независимый элемент).

What is the benefit: you can use the logotype as many times as you like on all pages, changing its appearance with a modifier, let's say header-block__logotype--large and by analogy with any element that is repeated more than once on the page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question