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
78
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
BEM
Talk about Block, Elements and Modifiers.
Felipe Luiz Soares
October 28, 2016
More Decks by Felipe Luiz Soares
See All by Felipe Luiz Soares
Writing unit tests with Jest using test best practices
felipesoares6
0
200
Comecei uma tarefa e olha no que deu!
felipesoares6
0
62
GraphQL & beyond
felipesoares6
0
60
HTML + CSS
felipesoares6
1
160
THE MEANING OF LIFE FRONT-END USER EXPERIENCE AND EVERYTHING
felipesoares6
0
68
Read-Search-Ask
felipesoares6
1
98
Other Decks in Technology
See All in Technology
実装だけじゃない! CCA-F取得エンジニアが教えるClaude Code開発プロセス活用術
diggymo
2
710
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
110k
AIと共生する開発者プラットフォーム:バクラクのモノレポ×マイクロサービス基盤
sakajunquality
2
3.5k
ローカルLLMとLINE Botの組み合わせ その3 / LINE DC Generative AI Meetup #8
you
PRO
0
130
kintone の AI コワーカーを、 Anthropic にエージェントを"ホストさせて"作った話 #devkinmeetup
sugimomoto
0
110
ソニー銀行におけるビジネスアジリティ向上のためのクラウドシフト戦略
srenext
0
230
アカウントが増えてからでは遅い? ~ マルチアカウント統制の勘所 ~
kenichinakamura
0
230
Databricks 生成AIガバナンス実践ワークショップ / LLMOps-workshop
databricksjapan
0
110
Making sense of Google’s agentic dev tools
glaforge
1
200
[2026-07-15] AI Ready なはずだったアーキテクチャと、見えてきた課題・次に目指す状態
wxyzzz
7
3.5k
あなたの『Site』はどこですか? — xREという考え方
miyamu
0
1.2k
事業価値を⽣み出すSREへ SREが担うべき意思決定の5層
kenta_hi
2
3.6k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
698
190k
Are puppies a ranking factor?
jonoalderson
1
3.7k
Product Roadmaps are Hard
iamctodd
55
12k
Why Our Code Smells
bkeepers
PRO
340
58k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
WCS-LA-2024
lcolladotor
0
680
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.1k
The Invisible Side of Design
smashingmag
301
52k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
330
So, you think you're a good person
axbom
PRO
2
2.1k
Believing is Seeing
oripsolob
1
170
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
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