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
200
1
Share
Naming CSS Stuff is Really Hard
Lightning talk for Dayton Clean Coders, 05/25/2014
Ethan Muller
May 20, 2014
More Decks by Ethan Muller
See All by Ethan Muller
Classifying Class Names
ethanmuller
2
160
Frontend Tooling @ Madison+ UX 2014
ethanmuller
1
65
Other Decks in Design
See All in Design
アイデアを加速させる!Firefly ボードで発想の幅を広げよう
connecre
1
400
AIでデザインをつくる:基礎編
kenichiota0711
4
3.1k
ISO 9241-171:2025っていうのがあってな
shosira
1
130
社長の宿題への回答 「新卒×AI」が生み出す価値
saki822
2
140
怖くないアクセシビリティ -カウンターカルチャーとしてのアッカン東京-
securecat
1
150
設計と制作 意図を形に表す / Design and Making: Intent Made Form
usagimaru
3
1.9k
Rethinking IFUs: What Board Game Rulebooks Contribute to IFU Usability
deadlinepoet
0
280
はじめての演奏会フライヤーデザイン
chorkaichan
1
300
デザイナーとエンジニアで 同じ山に登ろう
moco1013
0
220
「デザイン」の自分ごと化から始める、デザインピープルのふるまい
mewmo
0
240
デザインとフロントエンドの境界が融ける Claude Code × Figma
littlebusters
1
2.8k
情報を翻訳する-伝わる可視化3原則とオープンデータ活用-
hjmkth
1
250
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
150
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
370
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
Why Our Code Smells
bkeepers
PRO
340
58k
[SF Ruby Conf 2025] Rails X
palkan
2
1k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
360
Making Projects Easy
brettharned
120
6.6k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
160
The SEO identity crisis: Don't let AI make you average
varn
0
470
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.6k
Deep Space Network (abreviated)
tonyrice
0
150
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]