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
41
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
6
Build in Private
matheusrich
0
17
Start TDDing in 5 minutes
matheusrich
0
85
3 Steps Every Test Should Take
matheusrich
0
47
Taming God Objects: easy, incremental and secure
matheusrich
1
68
Stimulus 2.0-alpha - What's new?
matheusrich
0
40
De Repente 7
matheusrich
0
8
Other Decks in Programming
See All in Programming
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
640
Ruby Function Composition
bkuhlmann
1
330
Semantic search with Django and pgvector
pauloxnet
0
240
try! Swift Tokyo 2024 参加報告 / try! Swift Tokyo 2024 Report
hironytic
0
200
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
910
Zero Waste, Radical Magic, and Italian Graft – Quarkus Efficiency Secrets
hollycummins
0
230
Komplexe Oberflächen mit SVG und der Web Animation API
joergneumann
0
670
デフォルトにして至高、RubyMineの大好きな所
ruzia
0
290
Git Rebase
bkuhlmann
11
1.6k
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
820
CA.swift19 恋するAIアプリ開発の裏側
oskmr
0
360
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
130
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
10
990
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
2
3.4k
What's in a price? How to price your products and services
michaelherold
237
11k
Building an army of robots
kneath
300
41k
How to train your dragon (web standard)
notwaldorf
73
5.2k
How STYLIGHT went responsive
nonsquared
92
4.8k
Navigating Team Friction
lara
178
13k
RailsConf 2023
tenderlove
4
540
Documentation Writing (for coders)
carmenintech
60
3.9k
Producing Creativity
orderedlist
PRO
337
39k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
2
1.3k
Gamification - CAS2011
davidbonilla
76
4.6k
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/