Slide 1

Slide 1 text

Getting your CSS under control

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Observing that the maximum number of people who can productively simultaneously work on CSS is one.

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

1 person.

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

4 designers.

Slide 8

Slide 8 text

5 developers.

Slide 9

Slide 9 text

1 team.

Slide 10

Slide 10 text

1 project.

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

30 designers.

Slide 13

Slide 13 text

5 prototypers.

Slide 14

Slide 14 text

200 engineers.

Slide 15

Slide 15 text

multiple teams.

Slide 16

Slide 16 text

multiple projects.

Slide 17

Slide 17 text

CSS is easy.

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

li { }

Slide 21

Slide 21 text

oat: left padding: 3px 50px; margin: 0;

Slide 22

Slide 22 text

.block { display:block !important; } .inline { display:inline !important; } .hide { display:none !important; } .s-none { margin:0 !important; } .s { margin:10px !important; } .ss { margin:20px !important; } .sr { margin-right:10px !important; } .p-none { padding:0 !important; } .p { padding:10px !important; } .pp { padding:20px !important; } .pt { padding-top:10px !important; } .w-auto { width:auto !important; }

Slide 23

Slide 23 text

.layout_1_2 #blogList .pageitem .statusBar {} .layout_1_2 #blogList .pageitem .statusBar .status, #blogList .pageitem .statusBar .status .status1 { } .layout_1_2 #blogList .pageitem .statusBar .status { } .layout_1_2 #blogList .pageitem .statusBar .status .status1 { } .layout_1_2 #blogList .pageitem .statusBar .status .status1 a { } .layout_1_2 #blogList .pageitem .statusBar .status .status1 .sep {}

Slide 24

Slide 24 text

#comments .comment .meta .authorname {} #comments .comment .meta .commentnumber a {}

Slide 25

Slide 25 text

#nav-header ul li { float: left; } #nav-content ul li { float: left; }

Slide 26

Slide 26 text

4 Considerations

Slide 27

Slide 27 text

4 Categorization Naming Convention Decouple HTML/CSS Increase Semantics

Slide 28

Slide 28 text

1 Categorization

Slide 29

Slide 29 text

Categorization • Base • Layout • Module • State • Theme

Slide 30

Slide 30 text

Base

Slide 31

Slide 31 text

html { background-color: #FFF; font-family: Arial, Helvetica, sans-serif; font-size: 14px; } body { margin: 0; padding: 0; } h1, h2, h3 { margin: 1em 0; }

Slide 32

Slide 32 text

Layout

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Sidebar Content Header

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

Module

Slide 39

Slide 39 text

Customized List Button Tabs

Slide 40

Slide 40 text

.tab {} .listview {} .btn {}

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

Sub-modules

Slide 49

Slide 49 text

Large Search Dark Small

Slide 50

Slide 50 text

.btn {} .btn-large {} .btn-small {} .btn-default {} .btn-search {}

Slide 51

Slide 51 text

State

Slide 52

Slide 52 text

Active State Default State

Slide 53

Slide 53 text

.tab {} .is-tab-active {}

Slide 54

Slide 54 text

Theme

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

.theme-header {} .theme-border {} .theme-background {}

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

.text-plus1 {} .text-minus1 {}

Slide 60

Slide 60 text

2 Naming Convention

Slide 61

Slide 61 text

Naming Convention Naming convention clari es intent

Slide 62

Slide 62 text

Use Class over ID Speci city is dangerous

Slide 63

Slide 63 text

.grid {} .tab {} .is-tab-active {} .listview {} .is-hidden {} .btn {} .btn-large {} .btn-small {} .theme-border {} .theme-background {} .text-plus1 {} .text-minus1 {}

Slide 64

Slide 64 text

3 Decoupling CSS from HTML

Slide 65

Slide 65 text

.nav { margin: 0; padding: 0; list-style: none; } .nav li { float: left; } .nav li a { display: block; padding: 5px 10px; background-color: blue; }

Slide 66

Slide 66 text

Slide 67

Slide 67 text

Slide 68

Slide 68 text

.nav ul { margin: 0; padding:0; list-style:none; } .nav li li { float: none; } .nav li li a { padding: 2px; background-color: red; }

Slide 69

Slide 69 text

.nav { margin: 0; padding: 0; list-style: none; } .nav > li { float: left; } .nav > li > a { display: block; padding: 5px 10px; background-color: blue; }

Slide 70

Slide 70 text

.menu { margin: 0; padding: 0; list-style: none } .menu > li > a { display: block; padding: 2px; background-color: red; }

Slide 71

Slide 71 text

4 Increasing Semantics

Slide 72

Slide 72 text

Sites I Like

Slide 73

Slide 73 text

.box { border: 1px solid #333; } .box h2 { margin: 0; padding: 5px 10px; border-bottom: 1px solid #333; background-color: #CCC; } .box ul { margin: 10px; }

Slide 74

Slide 74 text

Sites I Like

About Us

The Fancy Pants Company is all about fancy pants.

Sponsored By

...

Slide 75

Slide 75 text

.box { border: 1px solid #333; } .box h2 { margin: 0; padding: 5px 10px; border-bottom: 1px solid #333; background-color: #CCC; } .box ul, .box p, .box div { margin: 10px; }

Slide 76

Slide 76 text

.box { border: 1px solid #333; } .box h2 { margin: 0; padding: 5px 10px; border-bottom: 1px solid #333; background-color: #CCC; } .box-body { margin: 10px; }

Slide 77

Slide 77 text

Sites I Like

About Us

The Fancy Pants Company is all about fancy pants.

Sponsored By

...

Slide 78

Slide 78 text

What does it mean?

Slide 79

Slide 79 text

Shift your thinking

Slide 80

Slide 80 text

Don’t code CSS for the page. Code it for the system.

Slide 81

Slide 81 text

Have your CSS... Do one thing and one thing only

Slide 82

Slide 82 text

State-based Design

Slide 83

Slide 83 text

State-based Design • A layout or module style • Sub-modules • JavaScript-driven states • Pseudo-class states • Media query states

Slide 84

Slide 84 text

CSS Panic

Slide 85

Slide 85 text

.enemys { z-index:3; position:absolute; top:0px; left:0; width:49px; height:93px; display:block; -webkit-appearance: button; -moz-appearance: button; background-position:0px 0px; background-repeat:no-repeat; -webkit-animation-iteration-count:infinite cursor:pointer; opacity:0.9; border:none;

Slide 86

Slide 86 text

.enemys { z-index:3; position:absolute; top:0px; left:0; width:49px; height:93px; display:block; -webkit-appearance: button; -moz-appearance: button; background-position:0px 0px; background-repeat:no-repeat; -webkit-animation-iteration-count:infinite cursor:pointer; opacity:0.9; border:none;

Slide 87

Slide 87 text

.enemys:checked{ overflow:hidden; -webkit-animation-name: none; -webkit-pointer-events: none; pointer-events: none; opacity:0; }

Slide 88

Slide 88 text

.enemys:checked{ overflow:hidden; -webkit-animation-name: none; -webkit-pointer-events: none; pointer-events: none; opacity:0; }

Slide 89

Slide 89 text

Forms

Slide 90

Slide 90 text

Who did you enjoy speaking today?

!

Slide 91

Slide 91 text

Who did you enjoy speaking today?

!

Slide 92

Slide 92 text

Who did you enjoy speaking today?

!

Slide 93

Slide 93 text

.other-input { display:none; } .other:checked ~ .other-input { display:block; }

Slide 94

Slide 94 text

.other-input { display:none; } .other:checked ~ .other-input { display:block; } Default State

Slide 95

Slide 95 text

.other-input { display:none; } .other:checked ~ .other-input { display:block; } Checked State

Slide 96

Slide 96 text

4 Categorization Naming Convention Decouple HTML/CSS Increase Semantics

Slide 97

Slide 97 text

GET SMACKED http://smacss.com/