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 - A simple CSS methodology
Search
Matheus Richard
March 19, 2020
Programming
0
48
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
36
Build in Private
matheusrich
0
64
Start TDDing in 5 minutes
matheusrich
0
98
3 Steps Every Test Should Take
matheusrich
0
80
Taming God Objects: easy, incremental and secure
matheusrich
1
97
Stimulus 2.0-alpha - What's new?
matheusrich
0
49
De Repente 7
matheusrich
0
13
Other Decks in Programming
See All in Programming
生成AI、実際どう? - ニーリーの場合
nealle
0
130
未来を拓くAI技術〜エージェント開発とAI駆動開発〜
leveragestech
2
160
令和最新版手のひらコンピュータ
koba789
14
7.8k
TanStack DB ~状態管理の新しい考え方~
bmthd
2
140
実践 Dev Containers × Claude Code
touyu
1
210
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
730
『リコリス・リコイル』に学ぶ!! 〜キャリア戦略における計画的偶発性理論と変わる勇気の重要性〜
wanko_it
1
540
JetBrainsのAI機能の紹介 #jjug
yusuke
0
210
ワープロって実は計算機で
pepepper
2
1.4k
What's new in Adaptive Android development
fornewid
0
140
実践!App Intents対応
yuukiw00w
1
280
Honoアップデート 2025年夏
yusukebe
1
750
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Being A Developer After 40
akosma
90
590k
Unsuck your backbone
ammeep
671
58k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
Building Adaptive Systems
keathley
43
2.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
770
Optimizing for Happiness
mojombo
379
70k
How GitHub (no longer) Works
holman
314
140k
Six Lessons from altMBA
skipperchong
28
4k
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/