Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Breaking Good Habits Harry Roberts—@csswizardry

Slide 3

Slide 3 text

Harry who?! •Web designer/developer •Senior UI Developer—BSkyB •@csswizardry •csswizardry.com

Slide 4

Slide 4 text

faavorite.com

Slide 5

Slide 5 text

Necessary explanation of the cheesy, overly- cryptic talk title.

Slide 6

Slide 6 text

Web standards… •A great idea? Definitely! •Well intentioned? You bet! •Ambiguous? Sadly :( •Open to interpretation? Unfortunately…

Slide 7

Slide 7 text

…web standards •Rules? Definitely not!

Slide 8

Slide 8 text

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?

Slide 9

Slide 9 text

Good habits? •Avoiding classes and IDs •‘Handcrafting’ our CSS •Avoiding extra markup

Slide 10

Slide 10 text

Bad habits? •Classitis—using too many classes •Grid systems •Extra markup •‘Insemantic’ class names

Slide 11

Slide 11 text

We’ve been solving the wrong problems for the wrong people!

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

The 4 ‘-ility’s •Maintainability •Flexibility •Extensibility •Predictability

Slide 14

Slide 14 text

Maintainability

Slide 15

Slide 15 text

Flexibility

Slide 16

Slide 16 text

body > div:nth-of-type(2) > article:first- child > p:first-child{ font-size:1.2em }

Lorem ipsum dolor sit amet...

Slide 17

Slide 17 text

Be ?#*@ing explicit!

Slide 18

Slide 18 text

.intro{ font-size:1.2em; }

Lorem ipsum dolor sit amet...

Slide 19

Slide 19 text

Extensibility

Slide 20

Slide 20 text

Extensible •Stop thinking in pages… •…think in components… •…then think in abstractions.

Slide 21

Slide 21 text

Predictability

Slide 22

Slide 22 text

Expect the unexpected Always build like your client’s CMS is a bulldozer…

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

CSS selectors

Slide 25

Slide 25 text

IDs •Don’t use IDs in CSS. •Ever.

Slide 26

Slide 26 text

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.

Slide 27

Slide 27 text

Classes •No one uses classes except browsers and other developers (and microformats). •Classes are neither semantic or insemantic; they’re sensible or insensible.

Slide 28

Slide 28 text

.red .red{ color:red; }

I am a designer and developer

Slide 29

Slide 29 text

.red .red{ color:blue; /* WTF */ }

I am a designer and developer

Slide 30

Slide 30 text

.brand .brand{ color:#BADA55; /* FTW */ }

I am a designer and developer

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Objects and abstractions

Slide 33

Slide 33 text

The media object bit.ly/cCY3Ew

Slide 34

Slide 34 text

The media object bit.ly/cCY3Ew

Slide 35

Slide 35 text

The media object bit.ly/cCY3Ew

Slide 36

Slide 36 text

The media object bit.ly/cCY3Ew

Slide 37

Slide 37 text

The media object bit.ly/cCY3Ew

Lorem ipsum...

.media,.body { overflow:hidden; } .img { float:left; margin-right:20px; } .img img { display:block; }

Slide 38

Slide 38 text

The media object bit.ly/cCY3Ew

Lorem ipsum...

Read more...

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Nicole Sullivan @stubbornella

Slide 41

Slide 41 text

The nav abstraction bit.ly/oD2M9n

Slide 42

Slide 42 text

.nav{ list-style:none; margin-left:0; } .nav li{ display:inline; } .nav a{ display:inline-block; } The nav abstraction bit.ly/oD2M9n

Slide 43

Slide 43 text

.breadcrumb li:before{ content:"» "; } .breadcrumb li:first-child:before{ content:""; } Breadcrumbs…? bit.ly/oD2M9n

Slide 44

Slide 44 text

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:; } bit.ly/yyReiE

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Grid systems

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

Abstract layout into its own layer Keep components free of dimensions

Slide 49

Slide 49 text

csswizardry.com/fluid-grids

Slide 50

Slide 50 text

Straighten up! @media(max-width:480px){ .grid{ float:none; clear:both; width:auto; margin:0; } }

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

All together now!

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

Benefits and side-effects •Sites are faster to build… •…more robust •…more maintainable •…more consistent •…and incidentally more efficient.

Slide 64

Slide 64 text

Now what? •Solve problems for the right people. •Keep yourselves happy and sane. •Learn when enough is enough; cut yourself some slack.

Slide 65

Slide 65 text

Breaking Good Habits •Harry Roberts – @csswizardry •csswizardry.com •faavr.it/csswizardry •Nicole Sullivan – @stubbornella