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
51
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
49
Build in Private
matheusrich
0
71
Start TDDing in 5 minutes
matheusrich
0
110
3 Steps Every Test Should Take
matheusrich
0
96
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
17
Other Decks in Programming
See All in Programming
AgentCoreとHuman in the Loop
har1101
5
230
CSC307 Lecture 01
javiergs
PRO
0
690
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
SourceGeneratorのススメ
htkym
0
190
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
180
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
高速開発のためのコード整理術
sutetotanuki
1
390
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
AI時代の認知負荷との向き合い方
optfit
0
150
組織で育むオブザーバビリティ
ryota_hnk
0
170
CSC307 Lecture 08
javiergs
PRO
0
670
ThorVG Viewer In VS Code
nors
0
770
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
6.8k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
Scaling GitHub
holman
464
140k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
66
36k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.2k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
450
Building AI with AI
inesmontani
PRO
1
680
Large-scale JavaScript Application Architecture
addyosmani
515
110k
The browser strikes back
jonoalderson
0
360
Code Reviewing Like a Champion
maltzj
527
40k
A better future with KSS
kneath
240
18k
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/