Slide 1

Slide 1 text

CSS POTLUCK

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

BENIFITS OF A POTLUCK

Slide 4

Slide 4 text

THE HIDDEN Features of CSS

Slide 5

Slide 5 text

CRITICAL PATH

Slide 6

Slide 6 text

NOTHING RENDERS UNTIL THE CRITICAL PATH IS DONE

Slide 7

Slide 7 text

UNTIL CSS IS DONE-DONE NOTHING RENDERS

Slide 8

Slide 8 text

GOOGLE DOESN'T LIKE RENDER BLOCKING CSS

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

INLINE THE CSS

Slide 11

Slide 11 text

Document body { background: red; color: #fff;} Content

Slide 12

Slide 12 text

DON'T @import

Slide 13

Slide 13 text

BODY LINKS

Slide 14

Slide 14 text

... body { background: red; color: #fff;} content sidebar footer

Slide 15

Slide 15 text

FIREFOX

Slide 16

Slide 16 text

Slide 17

Slide 17 text

JS IS BLOCKED BY CSS!

Slide 18

Slide 18 text

CDN FOR CSS CAN BE BAD

Slide 19

Slide 19 text

BASE 64 ENCODED IMAGES IN CSS BE BAD

Slide 20

Slide 20 text

HTTP2 DOWNLOADS LOTS OF FILES AT

Slide 21

Slide 21 text

CDN

Slide 22

Slide 22 text

JAVASCRIPT DEFER AND ASYNC

Slide 23

Slide 23 text

Slide 24

Slide 24 text

JS IS BLOCKED BY CSS!

Slide 25

Slide 25 text

Slide 26

Slide 26 text

Slide 27

Slide 27 text

ASYNC CSS?

Slide 28

Slide 28 text

JS and CSS preload example

Slide 29

Slide 29 text

CSS PROCESSING ORDER

Slide 30

Slide 30 text

KEY SELECTOR

Slide 31

Slide 31 text

#NAV LI A {}

Slide 32

Slide 32 text

DON'T OVER QUALIFY SELECTORS #nav li a {} #nav a {} better yet .nav-link {}

Slide 33

Slide 33 text

METHODOLOGIES ▸ Atomic ▸ OOCSS ▸ SMACSS ▸ BEM

Slide 34

Slide 34 text

▸ Tailwind ▸ Tachyons

Slide 35

Slide 35 text

PARSE SPEED

Slide 36

Slide 36 text

#nav .nav-link .nav-link span .nav-link * *

Slide 37

Slide 37 text

▸ ID, e.g. #header ▸ Class, e.g. .promo ▸ Type, e.g. div ▸ Adjacent sibling, e.g. h2 + p ▸ Child, e.g. li > ul ▸ Descendant, e.g. ul a ▸ Universal, i.e. * // Attribute, e.g. [type="text"] ▸ Pseudo-classes/-elements, e.g. a:hover

Slide 38

Slide 38 text

EXPENSIVE CSS PROPERTIES NTH-CHILD, FILTER, BOX-SHADOW

Slide 39

Slide 39 text

INEXPENSIVE POSITION, SCALE, ROTATION AND OPACITY

Slide 40

Slide 40 text

LAYOUT PAINT COMPOSITE

Slide 41

Slide 41 text

CSS TRIGGERS HTTPS://CSSTRIGGERS.COM/

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

COMPOSITE BE LIKE requestAnimationFrame

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

SCSS TRICKS

Slide 46

Slide 46 text

VARIBALES $cols: 12; $gutter: 20px; @for $col from 1 through $cols { .col-#{$col} { $pw: percentage($col/$cols); width: calc(#{$pw} - #{$gutter - $gutter / $col }); } }

Slide 47

Slide 47 text

FUNCTIONS

Slide 48

Slide 48 text

#{ $var and func() }

Slide 49

Slide 49 text

background: inline-svg("");

Slide 50

Slide 50 text

@function inline-svg($string) { @return url('data:image/svg+xml,#{url-encode($string)}'); }

Slide 51

Slide 51 text

CONDITOIONALS

Slide 52

Slide 52 text

$base-transition: 250ms all ease-in-out; $transitions: true; .#{$card}-details { background: #fff; @if ($transitions) { transition: $base-transition; } }

Slide 53

Slide 53 text

& & &

Slide 54

Slide 54 text

$card: card; .card { &-enclosed {} &.active, &:hover, &:focus {} }

Slide 55

Slide 55 text

.card-enclosed {} .card .active, .card :hover, .card:focus {}

Slide 56

Slide 56 text

SASS @extend AND MIXINS

Slide 57

Slide 57 text

.error { border: 1px #f00; background-color: #fdd; &--serious { @extend .error; border-width: 3px; } }

Slide 58

Slide 58 text

.error, .error--serious { border: 1px #f00; background-color: #fdd; } .error--serious { border-width: 3px; }

Slide 59

Slide 59 text

@mixin reset-list { list-style: none; } nav ul { @include reset-list; li { display: inline-block; } }

Slide 60

Slide 60 text

nav ul { list-style: none; } nav ul li { display: inline-block; }

Slide 61

Slide 61 text

IE 9, 10, 11 DIE JANUARY 10TH?

Slide 62

Slide 62 text

CSS VARABLES

Slide 63

Slide 63 text

:root { --main-bg-color: coral; } #div1 { background-color: var(--main-bg-color); }

Slide 64

Slide 64 text

SCOPING

Slide 65

Slide 65 text

/* default color */ :root { --color: blue; } div { --color: green; } .myclass { --color: red; } /* applies the --color property at all the above levels */ * { color: var(--color); }

blue

green
red

red

Slide 66

Slide 66 text

@supports

Slide 67

Slide 67 text

@supports (display: grid) and (flex: 1) { /* your rules */ } @supports not (display: grid) or (flex: 1) { /* your rules */ }

Slide 68

Slide 68 text

HOUDINI

Slide 69

Slide 69 text

Thanks, Kevin @kevindees https://kevdees.com