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
49
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
38
Build in Private
matheusrich
0
67
Start TDDing in 5 minutes
matheusrich
0
110
3 Steps Every Test Should Take
matheusrich
0
86
Taming God Objects: easy, incremental and secure
matheusrich
1
100
Stimulus 2.0-alpha - What's new?
matheusrich
0
51
De Repente 7
matheusrich
0
14
Other Decks in Programming
See All in Programming
Vue 3.6 時代のリアクティビティ最前線 〜Vapor/alien-signals の実践とパフォーマンス最適化〜
hiranuma
2
350
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
660
Temporal Knowledge Graphで作る! 時間変化するナレッジを扱うAI Agentの世界
po3rin
5
1.1k
なんでRustの環境構築してないのにRust製のツールが動くの? / Why Do Rust-Based Tools Run Without a Rust Environment?
ssssota
14
47k
マイベストのシンプルなデータ基盤の話 - Googleスイートとのつき合い方 / mybest-simple-data-architecture-google-nized
snhryt
0
110
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
650
Go言語はstack overflowの夢を見るか?
logica0419
0
670
Dive into Triton Internals
appleparan
0
380
他言語経験者が Golangci-lint を最初のコーディングメンターにした話 / How Golangci-lint Became My First Coding Mentor: A Story from a Polyglot Programmer
uma31
0
490
Swift Concurrency 年表クイズ
omochi
3
220
Inside of Swift Export
giginet
PRO
1
270
Featured
See All Featured
Navigating Team Friction
lara
190
15k
Mobile First: as difficult as doing things right
swwweet
225
10k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.7k
Gamification - CAS2011
davidbonilla
81
5.5k
A designer walks into a library…
pauljervisheath
209
24k
Stop Working from a Prison Cell
hatefulcrawdad
272
21k
Why Our Code Smells
bkeepers
PRO
340
57k
Code Review Best Practice
trishagee
72
19k
BBQ
matthewcrist
89
9.9k
For a Future-Friendly Web
brad_frost
180
10k
A Tale of Four Properties
chriscoyier
161
23k
Designing Experiences People Love
moore
142
24k
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/