A
A
Atlanta2018-10-05 18:56:34
css
Atlanta, 2018-10-05 18:56:34

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

1 answer(s)
B
BigSmoke, 2018-10-05
@Atlanta_Boston

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

Next, in index.html, insert this button like this:
And in contact.html like this
<button class="button content__contact-button">b</button>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question