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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Felipe Luiz Soares
October 28, 2016
Technology
0
74
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
190
Comecei uma tarefa e olha no que deu!
felipesoares6
0
56
GraphQL & beyond
felipesoares6
0
57
HTML + CSS
felipesoares6
1
150
THE MEANING OF LIFE FRONT-END USER EXPERIENCE AND EVERYTHING
felipesoares6
0
64
Read-Search-Ask
felipesoares6
1
94
Other Decks in Technology
See All in Technology
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
200
システムのアラート調査をサポートするAI Agentの紹介/Introduction to an AI Agent for System Alert Investigation
taddy_919
2
1.7k
変化するコーディングエージェントとの現実的な付き合い方 〜Cursor安定択説と、ツールに依存しない「資産」〜
empitsu
4
1.3k
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
17k
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
430
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.3k
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
2
850
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
170
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
440
プロダクト成長を支える開発基盤とスケールに伴う課題
yuu26
3
1.2k
データ民主化のための LLM 活用状況と課題紹介(IVRy の場合)
wxyzzz
2
660
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
530
Featured
See All Featured
Navigating Weather and Climate Data
rabernat
0
100
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
640
A Soul's Torment
seathinner
5
2.2k
エンジニアに許された特別な時間の終わり
watany
106
230k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
96
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
120
From π to Pie charts
rasagy
0
120
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
450
What's in a price? How to price your products and services
michaelherold
247
13k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
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