Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
BEM
Search
Felipe Luiz Soares
October 28, 2016
Technology
0
72
BEM
Talk about Block, Elements and Modifiers.
Felipe Luiz Soares
October 28, 2016
Tweet
Share
More Decks by Felipe Luiz Soares
See All by Felipe Luiz Soares
Writing unit tests with Jest using test best practices
felipesoares6
0
180
Comecei uma tarefa e olha no que deu!
felipesoares6
0
52
GraphQL & beyond
felipesoares6
0
55
HTML + CSS
felipesoares6
1
140
THE MEANING OF LIFE FRONT-END USER EXPERIENCE AND EVERYTHING
felipesoares6
0
59
Read-Search-Ask
felipesoares6
1
92
Other Decks in Technology
See All in Technology
サラリーマンの小遣いで作るtoCサービス - Cloudflare Workersでスケールする開発戦略
shinaps
2
470
Generative AI Japan 第一回生成AI実践研究会「AI駆動開発の現在地──ブレイクスルーの鍵を握るのはデータ領域」
shisyu_gaku
0
330
現場で効くClaude Code ─ 最新動向と企業導入
takaakikakei
1
260
KotlinConf 2025_イベントレポート
sony
1
140
AWSを利用する上で知っておきたい名前解決のはなし(10分版)
nagisa53
10
3.2k
要件定義・デザインフェーズでもAIを活用して、コミュニケーションの密度を高める
kazukihayase
0
120
「Linux」という言葉が指すもの
sat
PRO
4
140
「全員プロダクトマネージャー」を実現する、Cursorによる仕様検討の自動運転
applism118
22
12k
roppongirb_20250911
igaiga
1
250
2つのフロントエンドと状態管理
mixi_engineers
PRO
3
150
Codeful Serverless / 一人運用でもやり抜く力
_kensh
7
450
Snowflake Intelligence × Document AIで“使いにくいデータ”を“使えるデータ”に
kevinrobot34
1
120
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
It's Worth the Effort
3n
187
28k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Designing Experiences People Love
moore
142
24k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Building Applications with DynamoDB
mza
96
6.6k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
530
Producing Creativity
orderedlist
PRO
347
40k
Transcript
BEM Blocks, Elements and Modifiers Felipe Soares
FELIPE SOARES Apreciador de abacaxis github.com/felipesoares6 speakerdeck.com/felipesoares6 Front-end Developer Estagiário
na Codeminer 42
None
Bem is Blocks Elements and Modifiers
Bem is Is a component-based approach to web development. The
idea behind it is to divide the user interface into independent blocks. Understand the relationship between the HTML and CSS in a given project.
BLACK blocs
Blocks
Blocks A functionally independent page component that can be reused.
In HTML, blocks are represented by the class attribute.
Blocks The block name describes its purpose ("What is it?"
— menu or button).
Blocks can be nested in each other. You can have
any number of nesting levels. Blocks
<header class="header"> <div class="logo"></div> <form class="search-form"></form> </header>
Elements
Elements A composite part of a block that can't be
used separately from it.
Elements The element name describes its purpose ("What is this?"
— item, text, etc.) The structure of an element's full name is block-name__element-name.
Elements can be nested inside each other. You can have
any number of nesting levels. Elements An element is always part of a block, not another element.
<form class="search-form"> <input class="search-form__input"> <button class="search-form__button"> Search </button> </form>
Modifiers
Modifiers An entity that defines the appearance, state, or behavior
of a block or element.
Modifiers The modifier name describes its appearance ("What size?" or
"Which theme?" and so on — theme_islands), state ("How is it different from the others?" — disabled, focused), behavior ("How does it behave?" or "How does it respond to the user?" — such as directions_left-top).
From the BEM perspective, a modifier can't be used in
isolation from the modified block or element. Modifiers A modifier should change the appearance, behavior, or state of the entity, not replace it.
<form class="search-form search- form--focused"> <input class="search-form__input"> <button class=" search-form__button--disabled"> Search
</button> </form>
Should I create a block or an element?
If a section of code might be reused and it
doesn't depend on other page components being implemented, you should create a block.
If the section of code can't be used separately without
the parent entity (the block), an element is usually created.
SASS WAY
.search-form { background-color: red; &__button { margin: 20px; &--disabled {
display: none; } } } .form { display: flex; &--focused { color: black; } }
That’s all folks! flw vlw gretchen https://en.bem.info/ https://css-tricks.com/bem-101/ http://getbem.com/introduction/ https://unsplash.com/@pineapple