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
Ralph Penel Portfolio
ralphpenel
PRO
0
260
公開スライド)熊本市様-電子申請中級編
garyuten
0
820
「稼ぐ」だけでなく 「還す」ためのデザイン / Designship2025
culumu
1
570
kintone Style Book
kintone
6
10k
デザインを信じていますか
sekiguchiy
1
950
「デザイン」の自分ごと化から始める、デザインピープルのふるまい
mewmo
PRO
0
160
組織はみんなでつくる。デザイナーが仕掛ける急拡大する組織のカルチャーづくり
mkasumi
0
1.1k
Franks Myth
gfht1
1
410
デザイナーがはばたく未来の入り口『hatch』が描く、新しいデザイナー育成のカタチ
goodpatch
3
3.1k
越境するデザイン人材:デザイナーが社会資本となる世界へ
goodpatch
1
500
一次体験を起点にしたUX改善の取り組み / Direct Experience Driven UX Improvements
bitkey
PRO
0
370
Storyboard Exercise: Chase Sequence
lynteo
1
200
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.3k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
Google's AI Overviews - The New Search
badams
0
910
Code Review Best Practice
trishagee
74
20k
Color Theory Basics | Prateek | Gurzu
gurzu
0
200
The SEO Collaboration Effect
kristinabergwall1
0
350
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
Navigating Weather and Climate Data
rabernat
0
100
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Amusing Abliteration
ianozsvald
0
100
Testing 201, or: Great Expectations
jmmastey
46
8k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
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]