Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
BEM - A simple CSS methodology
Search
Matheus Richard
March 19, 2020
Programming
56
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
81
Build in Private
matheusrich
0
75
Start TDDing in 5 minutes
matheusrich
0
130
3 Steps Every Test Should Take
matheusrich
0
120
Taming God Objects: easy, incremental and secure
matheusrich
1
140
Stimulus 2.0-alpha - What's new?
matheusrich
0
57
De Repente 7
matheusrich
0
23
Other Decks in Programming
See All in Programming
続・コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions-again
handlename
0
120
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
1.4k
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
0
150
最近”作らせてる” ローカルAIアプリの話
akit37
0
500
Seven New Principles of Software Engineering
yegor256
0
290
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
120
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
120
Domain-Driven Transformation
hschwentner
2
2.3k
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
190
パスワード再設定メールのURLについて知っておこう
uyuki234
0
180
Next.js: The final boss of Web Performance
guaca
0
330
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
180
Featured
See All Featured
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
A better future with KSS
kneath
240
18k
Ethics towards AI in product and experience design
skipperchong
2
440
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
HDC tutorial
michielstock
2
970
It's Worth the Effort
3n
188
29k
A Soul's Torment
seathinner
8
3.8k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
640
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
640
Odyssey Design
rkendrick25
PRO
2
890
Building Flexible Design Systems
yeseniaperezcruz
330
41k
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/