Answer the question
In order to leave comments, you need to log in
What class to give to position elements with the same styles that are positioned differently depending on the page?
In BEM class naming, the block container for the element is important. Is there any similar principle only for elements on different pages? Those. elements with the same style are positioned differently depending on the page they are on. How can I write classes so that it's not bad practice?
I think I need something like this:
.index__button {
margin: 20px 30px;
}
.contact__button {
margin: 40px auto;
}
Answer the question
In order to leave comments, you need to log in
Probably in your situation, you need to set the parent (block) with two mix classes .
It will look like this:
.button <-- это ваша кнопка
какие-то стили
этой кнопки
.content <-- это блок, в котором она будет находится на обеих страницах
какие-то стили
этого блока
&__contact-button
margin 40px auto
&__index-button
margin 20px 30px
<button class="button content__contact-button">b</button>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question