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.5k
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
Site-Speed That Sticks
csswizardry
2
190
How to Think Like a Performance Engineer
csswizardry
22
1.2k
cache rules everything
csswizardry
3
3k
My Website Is Slow! Where Do I Start?
csswizardry
5
410
Optimising Largest Contentful Paint
csswizardry
33
3k
Get Your Head Straight
csswizardry
15
19k
From Milliseconds to Millions: A Look at the Numbers Powering Web Performance
csswizardry
1
2.4k
More Than You Ever Wanted to Know About Resource Hints
csswizardry
6
9k
It’s My (Third) Party, and I’ll Cry if I Want To
csswizardry
13
5.3k
Other Decks in Design
See All in Design
20240921-図書館の実空間とデジタル資源の接点をデザインする-dtk55-Designing-the-interface-between-the-library's-physical-space-and-digital-resources
majimasachi
0
380
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
180
Improve a service workshop
mastervicedesign
1
130
Rayout Pattern 01
one0
0
370
AIと創る広告の未来 ― タップルと極AIお台場スタジオの最新事例― / ai-tapple-odaiba
cyberagentdevelopers
PRO
1
530
Personal Story Sequence - Vendetta(WIP)
elrns88
0
340
美しいUIを作るために デザイナーが意識している ちょっとした考え方
yuichi_hara7
51
33k
Findy - デザイナー向け会社紹介 / Hiring Findy's Designers
findyinc
6
56k
Yahoo Newsletter Clicker Template
xuechunwu
0
300
LayerX DesignersDeck
layerx
PRO
0
910
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
170
横断組織デザイナーの働き方
mixi_design
PRO
0
200
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.2k
BBQ
matthewcrist
85
9.4k
Code Reviewing Like a Champion
maltzj
520
39k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Designing Experiences People Love
moore
138
23k
Unsuck your backbone
ammeep
669
57k
Designing for Performance
lara
604
68k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Adopting Sorbet at Scale
ufuk
73
9.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
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