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
63
Other Decks in Design
See All in Design
「批評」を習慣にするための仕組みと場のデザイン/uxdesign202507
nikkei_engineer_recruiting
6
800
1920*1080pxに設定したケース / Google Slide Size Test
arthur1
0
3.3k
第4回関東Kaggler会LT HCD-Net人間中心設計スペシャリストが語るNotebookメダルの取り方
utm529f
0
970
Карта реализации историй. Технология осмысленной работы с детальными требованиями
ashapiro
0
110
Spectrum Tokyo_ デザイナーが事業責任者になってみた
shin_2
0
130
AIで加速するアクセシビリティのこれから
magi1125
3
660
Memory Man v3 (WIP)
storybychad
PRO
0
2.5k
Them Middle School Kids Pitch
stevie_vee
0
130
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
240
地理院地図をもっと楽しく!れきちず新機能のご紹介
hjmkth
1
130
「UXとUIの違い」v2
shirasu3
0
230
#Dubois Challenge 2025: Economics
ajstarks
1
170
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
246
12k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
The Cult of Friendly URLs
andyhume
79
6.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Documentation Writing (for coders)
carmenintech
74
5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
Designing for humans not robots
tammielis
253
25k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
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]