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
91
Other Decks in Technology
See All in Technology
TechLION vol.41~MySQLユーザ会のほうから来ました / techlion41_mysql
sakaik
0
180
Wasm元年
askua
0
140
セキュリティの民主化は何故必要なのか_AWS WAF 運用の 10 の苦悩から学ぶ
yoh
1
130
AIの最新技術&テーマをつまんで紹介&フリートークするシリーズ #1 量子機械学習の入門
tkhresk
0
140
PHP開発者のためのSOLID原則再入門 #phpcon / PHP Conference Japan 2025
shogogg
4
730
【TiDB GAME DAY 2025】Shadowverse: Worlds Beyond にみる TiDB 活用術
cygames
0
1.1k
_第3回__AIxIoTビジネス共創ラボ紹介資料_20250617.pdf
iotcomjpadmin
0
150
AIのAIによるAIのための出力評価と改善
chocoyama
2
550
OpenHands🤲にContributeしてみた
kotauchisunsun
1
430
あなたの声を届けよう! 女性エンジニア登壇の意義とアウトプット実践ガイド #wttjp / Call for Your Voice
kondoyuko
4
440
20250625 Snowflake Summit 2025活用事例 レポート / Nowcast Snowflake Summit 2025 Case Study Report
kkuv
1
310
Windows 11 で AWS Documentation MCP Server 接続実践/practical-aws-documentation-mcp-server-connection-on-windows-11
emiki
0
960
Featured
See All Featured
Making Projects Easy
brettharned
116
6.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
We Have a Design System, Now What?
morganepeng
53
7.7k
The Pragmatic Product Professional
lauravandoore
35
6.7k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Raft: Consensus for Rubyists
vanstee
140
7k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
17
940
A Modern Web Designer's Workflow
chriscoyier
694
190k
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