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
Naming CSS Stuff is Really Hard
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ethan Muller
May 20, 2014
Design
1
200
Naming CSS Stuff is Really Hard
Lightning talk for Dayton Clean Coders, 05/25/2014
Ethan Muller
May 20, 2014
Tweet
Share
More Decks by Ethan Muller
See All by Ethan Muller
Classifying Class Names
ethanmuller
2
150
Frontend Tooling @ Madison+ UX 2014
ethanmuller
1
64
Other Decks in Design
See All in Design
はじめての演奏会フライヤーデザイン
chorkaichan
1
220
30分でわかるインサイトマネジメント(2025年12月バージョン)
centou
1
320
デザインするために「多様性」について考える
iflection
0
180
越境するデザイン人材:デザイナーが社会資本となる世界へ
goodpatch
1
500
AIスライドデザインを生成する仕組みを社内共有する
kenichiota0711
5
4.1k
Shaolin_Showdown
solmetts
0
290
AI情報に溺れながら、それでも頑張って泳ぐための思考法
yoriss67
0
130
Storyboard Assignment: Storyboard from Comic Strip
lynteo
3
180
DESIGNEAST 2025 A-3
_kotobuki_
0
130
図じゃなく言語で描く - Common Ground for Design AI Operations.
kazukiikeda
1
660
Franks Myth
gfht1
1
410
OSO2025-マサカリと太陽:伝え方の情報デザイン
majimasachi
0
680
Featured
See All Featured
Music & Morning Musume
bryan
47
7.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Site-Speed That Sticks
csswizardry
13
1.1k
Building an army of robots
kneath
306
46k
The browser strikes back
jonoalderson
0
370
The Curse of the Amulet
leimatthew05
1
8.5k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.2k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
270
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
54
Fireside Chat
paigeccino
41
3.8k
Believing is Seeing
oripsolob
1
55
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Transcript
@ethanmuller NAMING CSS STUFF IS REALLY HARD
SECTION 1: NAMING CSS STUFF IS REALLY EASY
<div class=“butts”>lol</div>
There are no rules.
/* help me */
SECTION 2: STRONG LINKS
.class-names are the links between {styles} and <elements>
“This element is styled this way because it is ________”
“This element is styled this way because it is ________”
(insert class name here)
If saying this makes sense, you’ve got a strong link.
None
Strong links make for comprehendible, maintainable code
SECTION 3: THE THREE BIG CATEGORIES
Logical Presentational Content-based
THE THREE BIG CATEGORIES LOGICAL .negative-button! ! .important-heading! ! .subtle-text
THE THREE BIG CATEGORIES LOGICAL ‣ Styles are being applied
for a reason ‣ The best option ‣ Usually not possible
THE THREE BIG CATEGORIES PRESENTATIONAL .big-text! ! .blue-button! ! .round-corners!
! .inset-box
THE THREE BIG CATEGORIES PRESENTATIONAL ‣ Names describe the appearance
of elements ‣ Names are self-describing ‣ Presentation changes require markup changes ‣ Conducive to style reuse
THE THREE BIG CATEGORIES CONTENT-BASED .product-photo! ! .submit-button! ! .contact-name!
! .intro-text
THE THREE BIG CATEGORIES CONTENT-BASED ‣ Names are based on
the content they’re styling ‣ Change presentation without touching markup ‣ Difficult to reuse styles ‣ Lots and lots of names ‣ Requires reading the stylesheet
Experts agree: Logical styles are best.
The problem is, Design ain’t always logical.
Logical Presentational Content-based
Let’s lay down a rule.
RULE-O-THUMB: The larger the project, the worse idea content- based
classes are.
Let’s think of more rules.
THANKS! @ethanmuller
[email protected]