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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Matheus Richard
March 19, 2020
Programming
55
0
Share
BEM - A simple CSS methodology
A short introduction to the BEM methodology for writing CSS.
Matheus Richard
March 19, 2020
More Decks by Matheus Richard
See All by Matheus Richard
The Fast Lane: Asynchronous Rails
matheusrich
0
69
Build in Private
matheusrich
0
73
Start TDDing in 5 minutes
matheusrich
0
120
3 Steps Every Test Should Take
matheusrich
0
110
Taming God Objects: easy, incremental and secure
matheusrich
1
130
Stimulus 2.0-alpha - What's new?
matheusrich
0
53
De Repente 7
matheusrich
0
21
Other Decks in Programming
See All in Programming
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
450
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.9k
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
500
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
350
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
1.1k
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
2.8k
JavaDoc 再入門
nagise
0
280
OSもどきOS
arkw
0
450
Modding RubyKaigi for Myself
yui_knk
0
890
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.4k
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
190
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
280
Between Models and Reality
mayunak
4
320
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
380
Producing Creativity
orderedlist
PRO
348
40k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
430
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
HDC tutorial
michielstock
2
690
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/