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
Breaking Good Habits
Search
Harry Roberts
February 12, 2012
Design
22
5.4k
Breaking Good Habits
Talk first given at The Digital Barn (Barnsley, UK) 11 February, 2012.
Harry Roberts
February 12, 2012
Tweet
Share
More Decks by Harry Roberts
See All by Harry Roberts
How to Think Like a Performance Engineer
csswizardry
16
1k
cache rules everything
csswizardry
3
2.9k
My Website Is Slow! Where Do I Start?
csswizardry
5
370
Optimising Largest Contentful Paint
csswizardry
31
2.8k
Get Your Head Straight
csswizardry
14
18k
From Milliseconds to Millions: A Look at the Numbers Powering Web Performance
csswizardry
1
2.3k
More Than You Ever Wanted to Know About Resource Hints
csswizardry
6
8.9k
It’s My (Third) Party, and I’ll Cry if I Want To
csswizardry
13
5.3k
FaCSSt: CSS & Performance
csswizardry
26
3.9k
Other Decks in Design
See All in Design
なぜデフォルトが青色!? Tint Colorの理由に迫る
akidon0000
0
340
『データモデリングでドメインを駆動する』で繋がる体験 / Drive domain with data modeling
tunemage
0
100
PdMというキャリアがUXデザイナーの頭によぎったとき スポットライトをどう当て、 どうシステムを見つめるか
muture
1
590
アフォーダンスとシグニファイア
ryokanakai
0
270
Осязаемый потребительский опыт. Ловим его за хвост с Картой процесса-опыта
ashapiro
2
120
デザインの専門性を活かしたナレッジマネジメント活動の実践と研究
chiemitaki
0
230
デザイナー視点の体験設計とデザインレビューを事業部全員で体験するワークショップをしたお話
masayofff
2
160
Mitra Manual
nnidhz
0
180
アクセシビリティって何だろう? -アクセシビリティの概念、そして向き合い方まで-
securecat
6
1.4k
Emil Storyboards (2024)
abbsant
0
160
IPの世界観に寄り添う、マルチブランドなカラーシステム設計
jirosh1998
1
11k
Cхематизация процессов и пользовательского опыта с Картой процесса-опыта
ashapiro
0
260
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
29
1.4k
The Language of Interfaces
destraynor
154
24k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
40
9.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
231
130k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
166
48k
How To Stay Up To Date on Web Technology
chriscoyier
786
250k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Debugging Ruby Performance
tmm1
72
12k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
32k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
2
210
Infographics Made Easy
chrislema
239
18k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Transcript
None
Breaking Good Habits Harry Roberts—@csswizardry
Harry who?! •Web designer/developer •Senior UI Developer—BSkyB •@csswizardry •csswizardry.com
Necessary explanation of the cheesy, overly- cryptic talk title.
Web standards… •A great idea? Definitely! •Well intentioned? You bet!
•Ambiguous? Sadly :( •Open to interpretation? Unfortunately…
…web standards •Rules? Definitely not!
Best practices •Best for who? •What are we achieving? •What
do we really want to achieve? •Are we always solving the right problems for the right people?
Good habits? •Avoiding classes and IDs •‘Handcrafting’ our CSS •Avoiding
extra markup
Bad habits? •Classitis—using too many classes •Grid systems •Extra markup
•‘Insemantic’ class names
We’ve been solving the wrong problems for the wrong people!
None
The 4 ‘-ility’s •Maintainability •Flexibility •Extensibility •Predictability
Maintainability
Flexibility
body > div:nth-of-type(2) > article:first- child > p:first-child{ font-size:1.2em }
<p>Lorem ipsum dolor sit amet...</p>
Be ?#*@ing explicit!
.intro{ font-size:1.2em; } <p class=intro>Lorem ipsum dolor sit amet...</p>
Specific !== explicit
Extensibility
Extensible •Stop thinking in pages… •…think in components… •…then think
in abstractions.
Predictability
Expect the unexpected Always build like your client’s CMS is
a bulldozer…
None
CSS selectors
IDs •Don’t use IDs in CSS •Ever.
IDs •No advantage over classes. •Waaaaaay overly specific. •Not dissimilar
to !important •Everything you can do with an ID can be done with a class.
Classes •No one uses classes except browsers and other developers
(and microformats). •Classes are neither semantic or insemantic; they’re sensible or insensible.
None
.red .red{ color:red; } <h1>I am a <span class=red>designer</span> and
<span class=red>developer</span></h1>
.red .red{ color:blue; /* WTF */ } <h1>I am a
<span class=red>designer</span> and <span class=red>developer</span></h1>
.brand .brand{ color:#BADA55; /* FTW */ } <h1>I am a
<span class=brand>designer</span> and <span class=brand>developer</span></h1>
None
Objects and abstractions
The media object bit.ly/cCY3Ew
The media object bit.ly/cCY3Ew
The media object bit.ly/cCY3Ew
The media object bit.ly/cCY3Ew
The media object bit.ly/cCY3Ew <div class=media> <img class=img> <p class=body>Lorem
ipsum...</p> </div> .media,.body { overflow:hidden; } .img { float:left; margin-right:20px; } .img img { display:block; }
The media object bit.ly/cCY3Ew <div class=media> <img class=img> <div class=body>
<p>Lorem ipsum...</p> <a href>Read more...</a> </div> </div>
None
Nicole Sullivan @stubbornella
The nav abstraction bit.ly/oD2M9n
.nav{ list-style:none; margin-left:0; } .nav li{ display:inline; } .nav a{
display:inline-block; } The nav abstraction bit.ly/oD2M9n
<ol class="nav breadcrumb">...</ol> .breadcrumb li:before{ content:"» "; } .breadcrumb li:first-child:before{
content:""; } Breadcrumbs…? bit.ly/oD2M9n
The island object bit.ly/oqQ7JJ
The island object bit.ly/oqQ7JJ <div class=island>...</div> .island{ padding:1.5em; } .island
> :last-child{ margin-bottom:0; }
The island object bit.ly/oqQ7JJ <div class="island promo">...</div> .island.promo{ color:#fff; background-color:#C0FFEE;
}
Double stranded heading hierarchy h1,.alpha { font-size:; line-height:; } h2,.beta
{ font-size:; line-height:; } h3,.gamma { font-size:; line-height:; } h4,.delta { font-size:; line-height:; } h5,.epsilon { font-size:; line-height:; } h6,.zeta { font-size:; line-height:; }
Double stranded heading hierarchy <div class=twitter> <h3 class=delta>Recent tweets</h3> ...
</div>
None
Grid systems
None
Abstract layout into its own layer Keep components free of
dimensions
csswizardry.com/fluid-grids
Straighten up! @media(max-width:480px){ .grid{ float:none; clear:both; width:auto; margin:0; } }
None
All together now!
None
None
None
None
None
None
None
None
None
None
Benefits and side- effects •Sites are faster to build… •…more
robust •…more maintainable •…more consistent •…and incidentally more efficient.
Efficiency on the client side •Reused classes are ‘performance freebies’
•Abstractions mean DRYer code; less to download and evaluate •Classes match quicker than descendants
Now what? •Solve problems for the right people. •Keep yourselves
happy and sane. •Learn when enough is enough; cut yourself some slack.
However bad you think it is, there’s always worse…
Breaking Good Habits •Harry Roberts – @csswizardry •csswizardry.com •Nicole Sullivan
– @stubbornella