Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
BEM
Search
Felipe Luiz Soares
October 28, 2016
Technology
86
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
66
GraphQL & beyond
felipesoares6
0
63
HTML + CSS
felipesoares6
1
160
THE MEANING OF LIFE FRONT-END USER EXPERIENCE AND EVERYTHING
felipesoares6
0
70
Read-Search-Ask
felipesoares6
1
100
Other Decks in Technology
See All in Technology
二歩目のフロントエンド・ウェブアクセシビリティ
camiha
2
620
『SAR衛星データ解析入門』のご紹介とその応用
syuchimu
0
120
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
460
ソフトウェア ファクトリー - 再現性のあるソフトウェアの工場づくり / Software factory
iktakahiro
6
4.9k
Local CI × GitHub Actions
gogutan
2
200
会社説明資料
persolserverworks
0
9.8k
Optunaの最新リリースv5.0について
pfn
PRO
0
120
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
7
6k
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
290
hackers_champloo_2026_tidb
makocchi
0
160
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
340
NDIでApple Vision Proにリアルタイム映像送信
jyouryuusui
0
120
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
How to Talk to Developers About Accessibility
jct
2
580
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
800
Exploring anti-patterns in Rails
aemeredith
4
540
Ethics towards AI in product and experience design
skipperchong
2
430
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Writing Fast Ruby
sferik
630
63k
Docker and Python
trallard
47
4.2k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
270
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
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