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
53
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
55
Build in Private
matheusrich
0
73
Start TDDing in 5 minutes
matheusrich
0
120
3 Steps Every Test Should Take
matheusrich
0
100
Taming God Objects: easy, incremental and secure
matheusrich
1
120
Stimulus 2.0-alpha - What's new?
matheusrich
0
53
De Repente 7
matheusrich
0
18
Other Decks in Programming
See All in Programming
それはエンジニアリングの糧である:AI開発のためにAIのOSSを開発する現場より / It serves as fuel for engineering: insights from the field of developing open-source AI for AI development.
nrslib
1
700
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
1.2k
実践ハーネスエンジニアリング #MOSHTech
kajitack
7
5.1k
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
3
420
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
140
How to stabilize UI tests using XCTest
akkeylab
0
150
Rethinking API Platform Filters
vinceamstoutz
0
4.2k
夢の無限スパゲッティ製造機 -実装篇- #phpstudy
o0h
PRO
0
180
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.7k
飯MCP
yusukebe
0
440
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
280
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
200
Featured
See All Featured
How GitHub (no longer) Works
holman
316
150k
[SF Ruby Conf 2025] Rails X
palkan
2
870
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
210
KATA
mclloyd
PRO
35
15k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
370
Being A Developer After 40
akosma
91
590k
Un-Boring Meetings
codingconduct
0
240
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
120
Marketing to machines
jonoalderson
1
5.1k
Believing is Seeing
oripsolob
1
100
The Invisible Side of Design
smashingmag
302
51k
Are puppies a ranking factor?
jonoalderson
1
3.2k
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/