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
44
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
27
Build in Private
matheusrich
0
53
Start TDDing in 5 minutes
matheusrich
0
88
3 Steps Every Test Should Take
matheusrich
0
64
Taming God Objects: easy, incremental and secure
matheusrich
1
76
Stimulus 2.0-alpha - What's new?
matheusrich
0
47
De Repente 7
matheusrich
0
11
Other Decks in Programming
See All in Programming
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
110
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
CSC509 Lecture 12
javiergs
PRO
0
160
CSC509 Lecture 09
javiergs
PRO
0
140
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
660
Featured
See All Featured
Thoughts on Productivity
jonyablonski
67
4.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Music & Morning Musume
bryan
46
6.2k
A Tale of Four Properties
chriscoyier
156
23k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
What's new in Ruby 2.0
geeforr
343
31k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
It's Worth the Effort
3n
183
27k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
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/