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
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
79
Build in Private
matheusrich
0
74
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
56
De Repente 7
matheusrich
0
22
Other Decks in Programming
See All in Programming
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
XHTMLが残したもの
yosuke_furukawa
PRO
1
410
信頼性の目標を誰も求めてない
shubox
0
490
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
0
140
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
6
2.1k
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
640
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
140
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
860
デプロイ直後のレイテンシスパイクを調べたら、 Railsの仕様にたどり着いた
nhsykym
0
110
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
110
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
150
一参加者から『中の人』へ 〜全通PHPerがブースに立って学んだ、カンファレンスを100倍楽しむコツ〜
wp_daisuke
0
120
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
41k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Facilitating Awesome Meetings
lara
57
7.1k
The World Runs on Bad Software
bkeepers
PRO
72
12k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
230
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.2k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
320
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/