I
I
IIIu6ko2018-02-22 21:28:17
css
IIIu6ko, 2018-02-22 21:28:17

Overriding styles in BEM mixes?

How to use mixes in BEM?
For example, I have a block with a logo, which is in both the header and the footer. In the footer, its margin differs from the margin that is set by default for the logo block. How is this supposed to work if my footer styles are higher than my logo styles?

<header class="header">
  <div class="logo">
    <img class="logo__img" src="path..." alt="logo" width="50" height="25">
  </div>
</header>

<footer class="footer">
  <div class="logo footer__logo">
    <img class="logo__img" src="path..." alt="logo" width="50" height="25">
  </div>
</footer>

.footer {
  &__logo {
    margin: 20px;
  }
}

.logo {
  margin: 10px;
}

That is, at me it is banal styles not to be redefined.
Maybe I don't understand something? Explain, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2018-02-22
@IIIu6ko

1. The block should not have a margin in principle
2. You need to use two mixes: .header__logo and .footer__logo
3. For a normal redefinition, use builds for BEM

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question