R
R
rtfm mftr2016-03-29 09:31:22
css
rtfm mftr, 2016-03-29 09:31:22

What are the same links with different icons in BEM?

We have something like

<ul class='social-list'> //блок
  <li class='social-list-item'> //блок
    <a class='social__btn'>facebook</a> //элемент
   </li>
   <li class='social-list-item'>
    <a class='social__btn'>twitter</a>
   </li>
   <li class='social-list-item'>
    <a class='social__btn'>vk</a>
   </li>
</ul>

And you need to add an icon to the background for each button. How is this implemented according to BEM?
Through the Modifier? <a class='social__btn social__btn--facebook'>...? It seems to be wrong, since there is no state change.
Through a separate Element for each button? <a class='social__btn-facebook'>? It’s somehow not elegant for each button to repeat a bunch of the same rules

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Serj-One, 2016-03-29
@rtfmmftr

Modifier.

D
devstudent, 2016-03-29
@devstudent

make a common class for everyone, and each of them also has its own unique one, then the background in the rules of the common class through a sprite, one picture for all , and each button has its own background-position value. And there won't be too many repetitions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question