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
43
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
24
Build in Private
matheusrich
0
38
Start TDDing in 5 minutes
matheusrich
0
87
3 Steps Every Test Should Take
matheusrich
0
56
Taming God Objects: easy, incremental and secure
matheusrich
1
73
Stimulus 2.0-alpha - What's new?
matheusrich
0
47
De Repente 7
matheusrich
0
11
Other Decks in Programming
See All in Programming
初心者がおさえておきたいAWS CDKのベストプラクティス 2024
konokenj
15
7.3k
GraphQL はいいぞ! ~Laravel で学ぶ GraphQL 入門~
azuki
1
160
OpenAI/Gemini APIを使って EPUBを翻訳するCLIツールをつくってみた
tomiyan
0
790
Harnessing Large Language Models for Training-free Video Anomaly Detection
tereka114
1
1.3k
AWS初心者ってどうやってAWSを学ぶ?〜アプリエンジニアがやってよかったアーキテクチャ学習方法〜
yamanashi_ren01
0
190
CSC307 Lecture 13
javiergs
PRO
0
150
Introduction to GitOps
hwchiu
0
110
feature環境をGitHub ActionsとCloudFormationでいい感じに管理する
nealle
2
310
CSC307 Lecture 14
javiergs
PRO
0
220
Cloudflare Workers x AWS Lambdaの組み合わせユースケース / Cloudflare Workers x AWS Lambda Combination Use Case
seike460
PRO
2
310
しくじり先生 Image Matching Challenge 2024 編
goosehaaan
0
810
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Berlin
prof18
0
110
Featured
See All Featured
Building Your Own Lightsaber
phodgson
101
5.9k
Leading Effective Engineering Teams 2024
addyosmani
3
300
Thoughts on Productivity
jonyablonski
64
4.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
229
130k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
90
47k
Docker and Python
trallard
37
2.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.3k
Producing Creativity
orderedlist
PRO
340
39k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
17
1.5k
Facilitating Awesome Meetings
lara
46
5.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
35
6.3k
Design by the Numbers
sachag
277
18k
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/