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
0
52
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
53
Build in Private
matheusrich
0
72
Start TDDing in 5 minutes
matheusrich
0
110
3 Steps Every Test Should Take
matheusrich
0
98
Taming God Objects: easy, incremental and secure
matheusrich
1
110
Stimulus 2.0-alpha - What's new?
matheusrich
0
52
De Repente 7
matheusrich
0
17
Other Decks in Programming
See All in Programming
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
150
Unity6.3 AudioUpdate
cova8bitdots
0
120
Ruby and LLM Ecosystem 2nd
koic
1
550
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1k
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
720
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
210
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
820
encoding/json/v2のUnmarshalはこう変わった:内部実装で見る設計改善
kurakura0916
0
400
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2.2k
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
1
240
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
360
Codex の「自走力」を高める
yorifuji
0
1.2k
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Six Lessons from altMBA
skipperchong
29
4.2k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
69
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
110
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
130
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Git: the NoSQL Database
bkeepers
PRO
432
66k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
260
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/