×
Copy
Open
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
Give CSS3 Some Love
Slide 2
Slide 2 text
Because CSS4 Is Coming!
Slide 3
Slide 3 text
Disclaimer:
Slide 4
Slide 4 text
CSS4 Isn’t A Thing
Slide 5
Slide 5 text
CSS Level 4 W orking Drafts
Slide 6
Slide 6 text
CSS2.1 Last Major Version
Slide 7
Slide 7 text
CSS Level 4 = CSS3 = CSS
Slide 8
Slide 8 text
Confusing Much?
Slide 9
Slide 9 text
What Am I Going T o T alk About
Slide 10
Slide 10 text
CSS3 Usage
Slide 11
Slide 11 text
How We Can Improve IT
Slide 12
Slide 12 text
What’s Coming Soon
Slide 13
Slide 13 text
@dancork
Slide 14
Slide 14 text
Holiday Extras
Slide 15
Slide 15 text
What’s The Problem
Slide 16
Slide 16 text
CSS3 Usage is Poor
Slide 17
Slide 17 text
T op 1 Million Websites http://trends.builtwith.com/css
Slide 18
Slide 18 text
Max Width 270,538
Slide 19
Slide 19 text
Max Width 27%
Slide 20
Slide 20 text
Min Width 209,608
Slide 21
Slide 21 text
Min Width 21%
Slide 22
Slide 22 text
Media Queries 48%
Slide 23
Slide 23 text
Chrome Anonymous Stats https://www .chromestatus.com/metrics/css/popularity
Slide 24
Slide 24 text
transform 42.5%
Slide 25
Slide 25 text
box-sizing 74.5%
Slide 26
Slide 26 text
T oo often the web interface ends up being the lowest common denominator Henrik Joreteg
Slide 27
Slide 27 text
Engineering a UI is complex
Slide 28
Slide 28 text
little control over the environment
Slide 29
Slide 29 text
Does the ux NEED to be the same?
Slide 30
Slide 30 text
Who uses multiple browsers?
Slide 31
Slide 31 text
elephant in the room
Slide 32
Slide 32 text
No content
Slide 33
Slide 33 text
http://caniuse.com/usage_table.php
Slide 34
Slide 34 text
IE8 1.38%
Slide 35
Slide 35 text
>98% support CSS3
Slide 36
Slide 36 text
CSS is unique
Slide 37
Slide 37 text
Passes over unknown properties
Slide 38
Slide 38 text
Less than half of web is responsive! IE is dying CSS is your friend CSS3 usage is poor
Slide 39
Slide 39 text
What Can Be Done?
Slide 40
Slide 40 text
Avoid vendor prefixes
Slide 41
Slide 41 text
border-radius: 5px;
Slide 42
Slide 42 text
-webkit-border-radius: 5px; -moz-border-radius: 5px; -ms-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px;
Slide 43
Slide 43 text
Will become outdated
Slide 44
Slide 44 text
technical debt
Slide 45
Slide 45 text
T ool up with Autoprefixer postcss/autoprefixer
Slide 46
Slide 46 text
W rite pure css
Slide 47
Slide 47 text
W orks with LESS and SASS
Slide 48
Slide 48 text
CLI, GRUNT , GULP or WEBP ACK
Slide 49
Slide 49 text
Minimises T echnical Debt
Slide 50
Slide 50 text
Media queries
Slide 51
Slide 51 text
No content
Slide 52
Slide 52 text
No content
Slide 53
Slide 53 text
Mobile first?
Slide 54
Slide 54 text
Majority of mobile browsers support queries
Slide 55
Slide 55 text
FOCUS ON JOBS, THEN SCREENS, BUT NEVER DEVICES https://blog.intercom.io/why-mobile-first-may-already-be-outdated/ Paul Adams
Slide 56
Slide 56 text
Box Sizing
Slide 57
Slide 57 text
Old box model was stupid
Slide 58
Slide 58 text
Especially when building a grid
Slide 59
Slide 59 text
Border Box
Slide 60
Slide 60 text
Feb 1 International Box Sizing Awareness Day
Slide 61
Slide 61 text
https://css- tricks.com/ international-box- sizing-awareness- day/
Slide 62
Slide 62 text
OMG! It works in IE8
Slide 63
Slide 63 text
html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; }
Slide 64
Slide 64 text
T ransform
Slide 65
Slide 65 text
T op/Left vs T ranslate
Slide 66
Slide 66 text
Positioning T op/Left
Slide 67
Slide 67 text
UI animation T ranslate
Slide 68
Slide 68 text
top/left has large paint time
Slide 69
Slide 69 text
3D transforms hardware accelerated
Slide 70
Slide 70 text
a { transform: translate3d(0,0,0); } a { transform: scale3d(1,1,1); }
Slide 71
Slide 71 text
a { transform: translateZ(0); } a { transform: scaleZ(1); }
Slide 72
Slide 72 text
no jank
Slide 73
Slide 73 text
not everything is accelerated
Slide 74
Slide 74 text
transform:translate transform:scale transform:rotate opacity
Slide 75
Slide 75 text
but you can do a lot with those!
Slide 76
Slide 76 text
Scale & Mouse events
Slide 77
Slide 77 text
Making Material Design https://www .youtube.com/watch?v=rrT6v5sOwJg
Slide 78
Slide 78 text
No content
Slide 79
Slide 79 text
No content
Slide 80
Slide 80 text
High Performance Animation http://www .html5rocks.com/en/tutorials/speed/high-performance-animations/
Slide 81
Slide 81 text
csstriggers. com
Slide 82
Slide 82 text
Vendor prefixes are stupid Go responsive, consider default Border-box all the things T ransform for UI Animation
Slide 83
Slide 83 text
The New Stuff
Slide 84
Slide 84 text
Feature Queries
Slide 85
Slide 85 text
@supports
Slide 86
Slide 86 text
@supports (display:flex) { section { display: flex } }
Slide 87
Slide 87 text
@supports (column-width: 20rem) and (column-span: all) { div { column-width: 20rem } div h2 { column-span: all } }
Slide 88
Slide 88 text
Limited Support?
Slide 89
Slide 89 text
JavaScript API
Slide 90
Slide 90 text
CSS.supports()
Slide 91
Slide 91 text
Polyfill
Slide 92
Slide 92 text
Media Queries
Slide 93
Slide 93 text
light-level
Slide 94
Slide 94 text
dim normal washed
Slide 95
Slide 95 text
@media (light-level: dim) { .app { background: black; color: white; } } @media (light-level: washed) { .app { background: white; color: black; } }
Slide 96
Slide 96 text
hover
Slide 97
Slide 97 text
none on-demand hover
Slide 98
Slide 98 text
.element .tooltip { /* hide tooltip */ } @media (hover) { .element .inline-tooltip { /* hide inline tooltip */ } .element:hover .tooltip { /* show tooltip */ } }
Slide 99
Slide 99 text
pointer
Slide 100
Slide 100 text
none coarse fine
Slide 101
Slide 101 text
.link { padding 1em; } @media (pointer:fine) { .link { padding: 0.25em; } }
Slide 102
Slide 102 text
any-hover any-pointer
Slide 103
Slide 103 text
pointer hover none hover course fine smartphones, touch screens stylus-based screens mouse, touch pad Nintendo Wii, Kinect
Slide 104
Slide 104 text
custom media queries
Slide 105
Slide 105 text
@custom-media --small (max-width: 520px); @media (--small) { /* styles for small viewport */ }
Slide 106
Slide 106 text
PostCSS postcss/postcss-custom-media
Slide 107
Slide 107 text
ranges
Slide 108
Slide 108 text
@media (min-width: 600px) and (max-width: 1000px) {}
Slide 109
Slide 109 text
@media (width > 600px) and (width < 1000px) {}
Slide 110
Slide 110 text
@media (600px < width < 1000px) {}
Slide 111
Slide 111 text
PostCSS postcss/postcss-media-minmax
Slide 112
Slide 112 text
Relational :has()
Slide 113
Slide 113 text
div:has(p){ background: #FF0000; }
Slide 114
Slide 114 text
Change CSS based on content
Slide 115
Slide 115 text
TO-DO
Slide 116
Slide 116 text
Slide 117
Slide 117 text
Slide 118
Slide 118 text
Slide 119
Slide 119 text
.todo ul { display:none; } .todo ul:has(li) { display:block; }
Slide 120
Slide 120 text
.todo ul:not(:has(li)) { display:none; }
Slide 121
Slide 121 text
Ordering is important
Slide 122
Slide 122 text
.todo ul:not(:has(li)) { display:none; }
Slide 123
Slide 123 text
.todo ul:has(:not(li)) { display:none; }
Slide 124
Slide 124 text
Browser support is limited
Slide 125
Slide 125 text
It’s non existent
Slide 126
Slide 126 text
We can try it
Slide 127
Slide 127 text
Polyfill.js philipwalton/polyfill
Slide 128
Slide 128 text
Polyfill({selectors: [“:has"]}) .doMatched(function (rules) { rules.each(function (rule) { $(rule.getSelectors()) .css(rule.getDeclaration()); }); });
Slide 129
Slide 129 text
Feature queries removes reliance on JavaScript :has() is too awesome!!! New media queries, understand the environment better
Slide 130
Slide 130 text
last decade's "pretty good” is today’s "a bit shit" Jake Archibald
Slide 131
Slide 131 text
Thank Y ou TWITTER: @DANCORK SLIDES: SPEAKERDECK.COM/DANCORK/FOWD2015