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
55
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
69
Build in Private
matheusrich
0
73
Start TDDing in 5 minutes
matheusrich
0
120
3 Steps Every Test Should Take
matheusrich
0
110
Taming God Objects: easy, incremental and secure
matheusrich
1
130
Stimulus 2.0-alpha - What's new?
matheusrich
0
53
De Repente 7
matheusrich
0
21
Other Decks in Programming
See All in Programming
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
110
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
190
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
340
LLM Plugin for Node-REDの利用方法と開発について
404background
0
160
net-httpのHTTP/2対応について
naruse
0
440
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
830
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
440
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
550
AutonomyとControlのあいだ:Graflowで記述するAIエージェント協調
myui
0
110
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.4k
OSもどきOS
arkw
0
450
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.5k
Featured
See All Featured
Accessibility Awareness
sabderemane
1
130
The Invisible Side of Design
smashingmag
302
52k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
150
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
840
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
550
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
240
WENDY [Excerpt]
tessaabrams
11
38k
Rails Girls Zürich Keynote
gr2m
96
14k
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
How to make the Groovebox
asonas
2
2.2k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Designing Experiences People Love
moore
143
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/