E
E
EarthFM2016-01-23 15:23:04
BEM
EarthFM, 2016-01-23 15:23:04

How to make BEM buttons?

I must say right away that I didn’t make sites using BEM)
The site will have a bunch of buttons and not the same ones, I correctly understood that we are creating a .btn block, and then if the button is search, then we create a .btn_search modifier, etc. That is, for each type of buttons we create a modifier? (.btn_search, .btn_submit)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
i, 2016-01-23
@EarthFM

That's right, the main class .btn describes the general style, and the .btn_search modification or addition is applied as follows:
It should be noted that .btn_search is the so-called. boolean modifier, according to the methodology, there may also be a key-value modifier .btn_type_search (see Naming convention/Modifier name for details ). I will assume that a modifier of the “key-value” type is more suitable for your task:

<div class="btn btn_type_search">search</div>
<div class="btn btn_type_submit">submit</div>

I recommend looking at the button block from the bem-components library .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question