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
190
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
130
Frontend Tooling @ Madison+ UX 2014
ethanmuller
1
61
Other Decks in Design
See All in Design
トップデザインチームが描く、 2030年に活躍するデザイナー
hiranotomoki
2
2.4k
Designship2024 Panel Discussion インハウスデザイナーは 何をデザインしているか、するべきか で使用したスライドを公開します。
kiyoshifuwa
0
2.1k
デザインからアプリ実装まで一貫したデザインシステムを構築するベストプラクティス
shuzo
13
6.1k
Dreamia
elsh
0
160
みんなでブラッシュアップするDesign Sprint_BASE BANKチームの場合
base
PRO
3
640
FANCL×CA流アプリリニューアルPJ 成功の秘訣とそのプロセス / dx-fancl-renewal
cyberagentdevelopers
PRO
2
330
Findy - デザイナー向け会社紹介 / Hiring Findy's Designers
findyinc
6
48k
デザインシステム×プロトタイピングで挑む社会的価値の共創 / Designship2024
visional_engineering_and_design
1
270
私の困りごとと解決案 / My issues and proposed solutions
kubosho
1
290
エムスリー株式会社 デザイングループ紹介資料 / m3design-team-profile
m3designer
0
4.3k
ito aya|Portfolio2409
itoaya116
0
260
シームレスな連携を実現するデザイントークンの設計と構築
amishiratori
0
340
Featured
See All Featured
Designing for humans not robots
tammielis
250
25k
A Tale of Four Properties
chriscoyier
156
23k
A Philosophy of Restraint
colly
203
16k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
GitHub's CSS Performance
jonrohan
1030
460k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
830
Code Review Best Practice
trishagee
64
17k
Why Our Code Smells
bkeepers
PRO
334
57k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
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]