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
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
設計と制作 意図を形に表す / Design and Making: Intent Made Form
usagimaru
3
2k
Rethinking IFUs: What Board Game Rulebooks Contribute to IFU Usability
deadlinepoet
0
340
CULTURE DECK/Marketing Director
mhand01
0
1.4k
個人理念(自分の言葉)の言語化ワークショップ
kakukoki
1
130
デザイナーが主導権を握る、AI協業の本音と実践
satosio
7
3.4k
セブンデックス プロジェクト事例 / innovation Scenes
sevendex
1
1.4k
AIネイティブスタートアップにおけるプロダクト開発の新常識 / Product Development Tips in AI-Native Startups
saka2jp
2
1.4k
【優秀賞+特別賞】くまモン食いしん坊弁当「くまモンの魔法の柑橘弁当」最終審査資料
shoko_seven11
0
230
hicard_credential_202601
hicard
0
260
Of Ordination and Rebellion exploration sketches
rezaline
0
180
工房としてのAI ── デザイナー、作家、ビルダー
hiranotomoki
0
370
研修担当者が一番伸びた 熊本市役所✕AI『泥臭いAI研修』のワークショップ設計について
garyuten
2
440
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
Technical Leadership for Architectural Decision Making
baasie
3
450
Everyday Curiosity
cassininazir
0
260
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
440
WCS-LA-2024
lcolladotor
0
770
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
KATA
mclloyd
PRO
35
15k
Product Roadmaps are Hard
iamctodd
55
12k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
From π to Pie charts
rasagy
0
240
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
360
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]