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
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
decksh object reference
ajstarks
2
1.5k
kintone_aroma
kintone
0
1.7k
「デザイン」の自分ごと化から始める、デザインピープルのふるまい
mewmo
0
190
「自分の仕事はどこまで?」と問い続けたら。デザイナーの「視座」を考える
mukai_takeru
0
320
OSO2025-マサカリと太陽:伝え方の情報デザイン
majimasachi
0
750
新規AIプロダクトで、事前に知るべきだった3つの壁 〜医療AIを1年間作って、従来の開発が通用しなかった話〜 / Three Walls in Building AI Products
shikichee
2
3.8k
20260215独立行政法人科学技術振興機構(JST) 社会技術研究開発センター(RISTEX)ケアが根づく社会システム _公開シンポジウム
a2k
0
130
2026年の勢い / Momentum for 2026
bebe
0
390
Goodpatch Tour💙 / We are hiring!
goodpatch
31
1.1M
体験負債を資産に変える組織的アプローチ
hikarutakase
0
790
Figma MCPを活用するためのデザインハンドブック
vivion
4
11k
OJTで学んだ 「心を動かす」ファシリテーション
saki822
1
270
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
110
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
270
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
320
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
240
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
How GitHub (no longer) Works
holman
316
150k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
WCS-LA-2024
lcolladotor
0
480
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]