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
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
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
490
CSC307 Lecture 15
javiergs
PRO
0
240
Fundamentals of Software Engineering In the Age of AI
therealdanvega
1
250
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
140
Ruby and LLM Ecosystem 2nd
koic
1
660
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
180
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
560
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
130
Codex の「自走力」を高める
yorifuji
0
1.2k
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2.3k
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
310
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
400
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Everyday Curiosity
cassininazir
0
160
sira's awesome portfolio website redesign presentation
elsirapls
0
190
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
160
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
100
Making Projects Easy
brettharned
120
6.6k
Testing 201, or: Great Expectations
jmmastey
46
8.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
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/