-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompat.html
306 lines (306 loc) · 9.99 KB
/
compat.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Future CSS Today</title>
<meta name="color-scheme" content="light dark" />
<link rel="stylesheet" href="compat.out.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⚡</text></svg>"
/>
<meta
name="description"
content="Modern CSS techniques we could use today."
/>
<meta name="twitter:label1" value="Reading time" />
<meta name="twitter:data1" value="Not too long" />
</head>
<body>
<main>
<section id="slide-0" class="slide" aria-labelledby="slide-0">
<hgroup>
<h1 id="slide-0">
<i>Future</i>
CSS Today ⚡
</h1>
<p>
Modern CSS techniques we could<sup>[1]</sup> use today. <br />
<a href="https://thib.me/">Thibaud Colas</a>
, <time>2023-10-18</time>
</p>
</hgroup>
<div class="slide-content">
<h2>Goals</h2>
<ol>
<li>No tooling 🔥</li>
<li>More with less</li>
<li>Great browser support</li>
</ol>
</div>
<div class="slide-footer">
<p>
Slides:
<a href="https://thib.me/tbx-css/">thib.me/tbx-css/</a>
</p>
<a href="">0</a>
</div>
</section>
<section id="slide-1" class="slide" aria-labelledby="slide-1-heading">
<hgroup>
<h2 id="slide-1-heading">No tooling?</h2>
<p>Tooling <em>where it makes sense</em>.</p>
</hgroup>
<div class="slide-content">
<ol>
<li>
Still using linting: <a href="https://prettier.io/">Prettier</a>,
<a href="https://stylelint.io/">Stylelint</a>.
</li>
<li>
Also still using compatibility & performance tools:
<a href="https://github.com/postcss/autoprefixer">Autoprefixer</a
>, <a href="https://cssnano.co/">cssnano</a>.
</li>
<li>
Writing modern syntax thanks to
<a href="https://preset-env.cssdb.org/">postcss-preset-env</a>.
</li>
</ol>
</div>
<div class="slide-footer">
<p>
Slides:
<a href="https://thib.me/tbx-css/">thib.me/tbx-css/</a>
</p>
<a href="#slide-1">1</a>
</div>
</section>
<section id="slide-2" class="slide" aria-labelledby="slide-2-heading">
<hgroup>
<h2 id="slide-2-heading">More with less?</h2>
<p>Vanilla CSS without compromising on expressiveness</p>
</hgroup>
<div class="slide-content">
<ol>
<li>Co-location of related code</li>
<li>Not a thousand lines of code</li>
<li>No overrides</li>
</ol>
</div>
<div class="slide-footer">
<div></div>
<a href="#slide-2">2</a>
</div>
</section>
<section id="slide-3" class="slide" aria-labelledby="slide-3-heading">
<hgroup>
<h2 id="slide-3-heading">Great browser support?</h2>
<p>
Support older browsers so users don’t have to upgrade their devices.
</p>
</hgroup>
<div class="slide-content">
<ul>
<li>Opera Mini (1%)</li>
<li>IE11 (0.5%)</li>
<li>Safari 12-14 (0.5%)</li>
<li>Android Browser 4.4.4 (0.3%)</li>
<li>Chrome 69-89 (1.2%)</li>
<li>Firefox 3.6</li>
</ul>
</div>
<div class="slide-footer">
<p>
<a
href="https://caniuse.com/?compare=firefox+3.6,ie+11,op_mini+all,android+4.4.3-4.4.4&compareCats=all"
>caniuse.com/ciu/comparison</a
>
</p>
<a href="#slide-3">3</a>
</div>
</section>
<section id="slide-4" class="slide" aria-labelledby="slide-4-heading">
<hgroup>
<h2 id="slide-4-heading">More with less, continued</h2>
<p>Things in CSS that take lots of lines for no reason</p>
</hgroup>
<div class="slide-content">
<ul>
<li><strong>Responsive design</strong> - avoid media queries</li>
<li>
<strong>Interaction styles</strong> (hover, focus, touch, etc.)
</li>
<li><strong>Right-to-left</strong> support</li>
<li><strong>Light and dark</strong> themes</li>
<li>
<strong>Contrast themes</strong> / Windows High Contrast Mode
</li>
<li><strong>Print stylesheets</strong></li>
</ul>
</div>
<div class="slide-footer">
<div></div>
<a href="#slide-4">4</a>
</div>
</section>
<section id="slide-5" class="slide" aria-labelledby="slide-5-heading">
<hgroup>
<h2 id="slide-5-heading">CSS patterns: layout</h2>
</hgroup>
<div class="slide-content">
<ul>
<li>Flexbox and Grid 🐸</li>
<li>Logical properties and values</li>
</ul>
<pre dir="auto">
<code>
.slide-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
margin-inline-start: 5rem;
}
</code>
</pre>
</div>
<div class="slide-footer">
<p>
<a href="https://flexboxfroggy.com/">flexboxfroggy.com</a>
</p>
<a href="#slide-5">5</a>
</div>
</section>
<section id="slide-6" class="slide" aria-labelledby="slide-6-heading">
<hgroup>
<h2 id="slide-6-heading">Typography</h2>
</hgroup>
<div class="slide-content">
<ul>
<li>System font stack</li>
<li>Dynamic viewport units</li>
<li><code>clamp()</code></li>
</ul>
<pre dir="auto"><code>
body {
font-family: "Segoe UI","system-ui","Roboto","Helvetica Neue","Arial",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
font-size: clamp(1rem, calc(2dvmax + 1rem), 5dvmin);
}
</code></pre>
</div>
<div class="slide-footer">
<p>
<a href="https://web.dev/articles/viewport-units"
>web.dev/articles/viewport-units</a
>
</p>
<a href="#slide-6">6</a>
</div>
</section>
<section id="slide-7" class="slide" aria-labelledby="slide-7-heading">
<hgroup>
<h2 id="slide-7-heading">Colors</h2>
<p>All of them!</p>
</hgroup>
<div class="slide-content">
<ul>
<li>CSS variables</li>
<li><code>oklch()</code></li>
<li><code>color-mix()</code></li>
<li>System colors</li>
</ul>
<pre dir="auto">
<code>
--light-dark: color-mix(in oklch, CanvasText 10%, Canvas 50%);
--dark-light: color-mix(in oklch, Canvas 10%, CanvasText 50%);
color: color-mix(in oklch, var(--light-dark) 20%, CanvasText);
</code>
</pre>
</div>
<div class="slide-footer">
<p>
<a href="https://www.w3.org/TR/css-color-4/#css-system-colors"
>w3.org/TR/css-color-4</a
>
</p>
<a href="#slide-7">7</a>
</div>
</section>
<section id="slide-8" class="slide" aria-labelledby="slide-8-heading">
<hgroup>
<h2 id="slide-8-heading">Demo!</h2>
<p>View source</p>
</hgroup>
<div class="slide-content"></div>
<div class="slide-footer">
<p>
<a href="view-source:">view-source:</a>
</p>
<a href="#slide-8">8</a>
</div>
</section>
<section id="slide-9" class="slide" aria-labelledby="slide-9-heading">
<hgroup>
<h2 id="slide-9-heading">Does it work?</h2>
<p>Yes and no</p>
</hgroup>
<div class="slide-content">
<ul>
<li>This shows promise but there are still a lot of hurdles.</li>
<li>
Likely practical for small projects within the next 2 years.
</li>
<li>Early adopters can use this now with little compromises.</li>
</ul>
</div>
<div class="slide-footer">
<div></div>
<a href="#slide-9">9</a>
</div>
</section>
<section id="slide-10" class="slide" aria-labelledby="slide-10-heading">
<hgroup>
<h2 id="slide-10-heading">Takeways for pro™ projects</h2>
<p>Great things you should definitely use on projects</p>
</hgroup>
<div class="slide-content">
<ol>
<li>Media queries 💯</li>
<li>CSS variables 💅</li>
<li>
<a href="https://sass-lang.com/">Sass</a> and
<a href="https://postcss.org/">PostCSS</a> tooling
</li>
</ol>
</div>
<div class="slide-footer">
<p>
Slides:
<a href="https://thib.me/tbx-css/">thib.me/tbx-css/</a>
</p>
<a href="#slide-10">10</a>
</div>
</section>
<section id="slide-11" class="slide" aria-labelledby="slide-11-heading">
<hgroup>
<h2 id="slide-11-heading">Thanks!</h2>
<p>
<a href="https://preset-env.cssdb.org/features/"
>preset-env.cssdb.org/features</a
>
</p>
</hgroup>
<div class="slide-content"></div>
<div class="slide-footer">
<p>
Slides:
<a href="https://thib.me/tbx-css/">thib.me/tbx-css/</a>
</p>
<a href="#slide-11">11</a>
</div>
</section>
</main>
</body>
</html>