Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
BEM - A simple CSS methodology
Search
Matheus Richard
March 19, 2020
Programming
0
50
BEM - A simple CSS methodology
A short introduction to the BEM methodology for writing CSS.
Matheus Richard
March 19, 2020
Tweet
Share
More Decks by Matheus Richard
See All by Matheus Richard
The Fast Lane: Asynchronous Rails
matheusrich
0
42
Build in Private
matheusrich
0
69
Start TDDing in 5 minutes
matheusrich
0
110
3 Steps Every Test Should Take
matheusrich
0
89
Taming God Objects: easy, incremental and secure
matheusrich
1
110
Stimulus 2.0-alpha - What's new?
matheusrich
0
51
De Repente 7
matheusrich
0
16
Other Decks in Programming
See All in Programming
WebRTC と Rust と8K 60fps
tnoho
2
2k
20 years of Symfony, what's next?
fabpot
2
350
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
210
SwiftUIで本格音ゲー実装してみた
hypebeans
0
300
認証・認可の基本を学ぼう後編
kouyuume
0
190
30分でDoctrineの仕組みと使い方を完全にマスターする / phpconkagawa 2025 Doctrine
ttskch
3
830
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
9
1.1k
関数実行の裏側では何が起きているのか?
minop1205
1
690
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
2.3k
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
210
AIコーディングエージェント(skywork)
kondai24
0
160
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
500
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
How to train your dragon (web standard)
notwaldorf
97
6.4k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
A Modern Web Designer's Workflow
chriscoyier
698
190k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Faster Mobile Websites
deanohume
310
31k
Agile that works and the tools we love
rasmusluckow
331
21k
GitHub's CSS Performance
jonrohan
1032
470k
Transcript
BEM Easy. Modular. Flexible.
What comes to your mind when you think of CSS?
None
And CSS in a big project?
None
Why?
Why do we have a low bar in terms of
CSS code quality?
Web History • Everything was designed to share documents •
CSS had a different intention • Web apps became a thing
Several problems
Inline CSS Code duplication Browser incompatibility
None
Goals • Reuse code • Organization • Standardization • Modularization
• Simplicity
BEM Block__Element--Modifier
Block Standalone entity that is meaningful on its own.
Block Naming Block names may consist of Latin letters, digits,
and dashes
Element A part of a block that has no standalone
meaning and is semantically tied to its block
Element An element CSS class is formed as block name
plus two underscores plus element name
None
Element An element CSS class is formed as block name
plus two underscores plus element name
Element An element CSS class is formed as block name
plus two underscores plus element name
Modifier A flag on a block or element. Use them
to change appearance or behavior.
Modifier Naming A modifier CSS class is formed as block’s
or element’s name plus two dashes
Modifier HTML Remember that modifiers only carry modifications!
Rule of thumb Use meaningful names
None
Benefits
Modularity • Block styles are independent. No cascading problems. •
You also get the ability to transfer blocks from your finished projects to new ones.
Reusability • Composing independent blocks in different ways, and reusing
them intelligently, reduces the amount of CSS code that you will have to maintain. • You can build a library of blocks.
Structure • BEM methodology gives your CSS code a solid
structure that remains simple and easy to understand.
Easy • Only three core elements • No 3rd-party library
needed • You can start applying it now
That’s it Feel free to ask any question
That was just the basics... • https://en.bem.info/methodology/quick -start/ • http://getbem.com/introduction/