-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
430 lines (371 loc) · 12.9 KB
/
index.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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/black.css">
<!-- Theme used for syntax highlighted code -->
<link rel="stylesheet" href="plugin/highlight/monokai.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<!-- Intro -->
<section data-background-image="img/aldebaran-s-qtRF_RxCAo0-unsplash.jpg">
<div class="absolute glow star">.</div>
<div class="absolute glow star2">.</div>
<div>
<h1 class="glow">Container Queries:<br/> the New Frontier</h1>
<h3>Una Kravets | @una | #DevFestForUkraine 🇺🇦</h3>
</div>
</section>
<section>
<ul class="grid-3x" style="gap: 2rem">
<li><img src="img/Flag_of_Ukraine.svg.png" style="width: 90%; margin: 0 auto" alt=""></li>
<li class="fragment"><img src="img/chrome-logo.png" alt=""></li>
<li class="fragment"><img src="img/oui-logo.png" alt=""></li>
</ul>
<aside class="notes">A little bit about me.</aside>
</section>
<section>
<ul class="grid-3x" style="gap: 2rem">
<li><img src="img/FMjBtrDWQAMqFlo.jpeg" alt=""></li>
<li><img src="img/FMjBtrFXwAUHPgq.jpeg" alt=""></li>
<li><img src="img/FMjBtrpWQAU2SMV.jpeg" alt=""></li>
</ul>
</section>
<section>
<img src="img/space-stylesheets.png" style="max-width: 80%" alt="">
</section>
<section data-background-image="img/niketh-vellanki-QkSN_8XcXwQ-unsplash.jpg">
<aside class="notes">And a little bit about you. You might feel lost, floating in outter space as all of these new CSS features land</aside>
</section>
<section data-background-image="img/ju-guan-D-jLxBtEwaA-unsplash.jpg">
<h2 class="fragment">I ♥ CSS</h2>
<aside class="notes">But I'm here to bring you back to earth. And show you how to use one of the most powerful new tools CSS has to offer. AND how to make it work cross-browser today.</aside>
</section>
<section>
<h2>Today we'll learn</h2>
<ul>
<li class="fragment">What are container queries?</li>
<li class="fragment">How to use <code>@container</code></li>
<li class="fragment">Container units</li>
<li class="fragment">Types of container queries</li>
<li class="fragment">Using container queries today</li>
</ul>
</section>
<section>
<img src="img/cq-gen-illi.png" alt="">
</section>
<section>
<img src="img/cq-plant-illi-1.png" alt="">
</section>
<section>
<img src="img/cq-plant-illi-2.png" alt="">
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://codepen.io/una/debug/mdOgyVL" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://codepen.io/una/pen/mdOgyVL">Codepen Link</a>
</section>
<section>
<h2>Anatomy of a container query</h2>
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://codepen.io/una/debug/wvyXQXY" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://codepen.io/una/pen/wvyXQXY">Codepen Link</a>
</section>
<section>
<h2>Step 1: Set Containment on the parent</h2>
</section>
<section>
<pre><code class="css">
.parent {
container-type: inline-size;
}
</code></pre>
</section>
<section>
<img src="img/mLz4eB2iG7yGUJ92DA0D.avif" alt="">
</section>
<section>
<img src="img/NcIz3jADhMnRMqRTUPKr.avif" alt="">
</section>
<section>
<h2>Step 2: Query the parent</h2>
</section>
<section>
<pre><code class="css">
@container (max-width: 400px) {
.card {
// child styles when the parent is < 400px wide
}
}
</code></pre>
</section>
<section>
<pre><code class="css">
@container (max-width: 400px) {
.card {
grid-template-columns: 1fr;
}
}
</code></pre>
</section>
<section>
<pre><code class="css">
/* Default styles (wide) */
.card {
display: grid;
grid-template-columns: 1fr 1fr;
}
/* Adjusted styles (narrow) */
@container (max-width: 400px) {
.card {
grid-template-columns: 1fr;
}
}
</code></pre>
</section>
<section>
<pre><code class="css">
/* Default styles (narrow) */
.card {
display: grid;
grid-template-columns: 1fr;
}
/* Adjusted styles (wide) */
@container (min-width: 400px) {
.card {
grid-template-columns: 1fr 1fr;
}
}
</code></pre>
</section>
<section>
<h2>Can't you do that with a media query?</h2>
</section>
<section>
<img src="img/cq-gen-illi.png" alt="">
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://codepen.io/una/debug/XWZodbm" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://codepen.io/una/debug/XWZodbm">Codepen Link</a>
</section>
<section>
<h2>Named Containers</h2>
</section>
<section>
<h3>Named containers</h3>
<pre><code class="css">
.parent {
container-type: inline-size;
container-name: card-parent;
}
</code></pre>
</section>
<section>
<h3><code>container</code> shorthand</h3>
<pre><code class="css">
.parent {
container: card-parent / inline-size;
}
</code></pre>
</section>
<section>
<pre><code class="css">
.card {
display: grid;
grid-template-columns: 1fr;
}
/* More explicit with container-name */
@container card-parent (min-width: 400px) {
.card {
grid-template-columns: 1fr 1fr;
}
}
</code></pre>
</section>
<section>
<h2>Container Queries + <code>:has()</code> = a dream made in responsive heaven</h2>
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://codepen.io/una/debug/WNMyYBB" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://codepen.io/una/pen/WNMyYBB">Codepen Link</a>
</section>
<section>
<h2>Fluid typography</h2>
</section>
<section>
<h3>Fluid typography using <code>clamp()</code></h3>
<pre><code class="language-css">
h1 {
font-size: clamp(minValue, actualValue, maxValue);
}
</code></pre>
</section>
<section>
<img src="https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/121943ab-55fa-4315-a0b0-e9283b2be0a3/3-modern-fluid-typography-css-clamp.png" alt="">
<a class="demo-link" href="https://www.smashingmagazine.com/2022/01/modern-fluid-typography-css-clamp/">Fluid typography article by Adrian Bece</a>
</section>
<section>
<h3>Fluid typography using <code>clamp()</code></h3>
<pre><code class="language-css">
h1 {
font-size: clamp(2rem, 10vw, 4rem);
}
</code></pre>
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://codepen.io/una/debug/VwQqjzN" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://codepen.io/una/pen/VwQqjzN">Codepen Link</a>
</section>
<section>
<h2>Container-based Units</h2>
</section>
<section>
<table><thead><tr><th>unit</th><th>relative to</th></tr></thead><tbody><tr><td><code>cqw</code></td><td>1% of a query container’s width</td></tr><tr><td><code>cqh</code></td><td>1% of a query container’s height</td></tr><tr><td><code>cqi</code></td><td>1% of a query container’s inline size</td></tr><tr><td><code>cqb</code></td><td>1% of a query container’s block size</td></tr><tr><td><code>cqmin</code></td><td>The smaller value of qi or qb</td></tr><tr><td><code>cqmax</code></td><td>The larger value of qi or qb</td></tr></tbody></table>
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://codepen.io/una/debug/eYVbzGy" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://codepen.io/una/pen/eYVbzGy">Codepen Link</a>
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://codepen.io/una/debug/abqPdQv" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://codepen.io/una/debug/abqPdQv">Codepen Link</a>
</section>
<section>
<h2>Style Queries (future)</h2>
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://codepen.io/una/debug/abqKvXW" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://codepen.io/una/debug/abqKvXW">Codepen Link</a>
</section>
<section>
<h2>State Queries (further future)</h2>
</section>
<section>
<ul>
<li><code>:is-stuck</code></li>
<li class="fragment"><code>:snapped</code></li>
<li class="fragment"><code>position-set-1</code></li>
</ul>
</section>
<section>
<h2>Combining Queries</h2>
</section>
<section>
<h3>Combinator queries</h3>
<pre><code class="css">
@container card (inline-size > 30em) and (--responsive = true) {
/* styles */
}
</code></pre>
</section>
<section>
<h2>Container Queries In Production</h2>
</section>
<section>
<h2>Support</h2>
<ul class="grid-3x">
<li>
<img width=80% src="img/chrome-logo.png" alt="">
<p>Chromium (🏁)</p>
</li>
<li>
<img width=80% src="img/Safari_browser_logo.svg" alt="">
<p>Webkit TP (16+)</p>
</li>
<li>
<img width=80% src="img/Firefox_logo.svg" alt="">
<p>Gecko (polyfill)</p>
</li>
</ul>
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://chromeos.dev" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://chromeos.dev">ChromeOS.dev</a>
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://designcember.com" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://designcember.com">designcember.com</a>
</section>
<section>
<h2>Container Query Polyfill</h2>
<p>github.com/GoogleChromeLabs/container-query-polyfill</p>
</section>
<section>
<div class="resize" style="height: 600px">
<iframe style="background: white;" width=100% height=100% src="https://github.com/GoogleChromeLabs/container-query-polyfill" frameborder="0"></iframe>
</div>
<a class="demo-link" href="https://github.com/GoogleChromeLabs/container-query-polyfill">Container Query Polyfill</a>
</section>
<section>
<h2>Container queries are useful anywhere you have reusable components</h2>
</section>
<section data-transition="none">
<img src="img/bustle-homepage.png" alt="">
<aside class="notes">what this might look like on a production site. Bustle doesn't actually use CQ (yet) but I thought it was a good example of modular design</aside>
</section>
<section data-transition="none">
<img src="img/bustle-containers-marked-up.png" alt="">
</section>
<section>
<h2>Intrinsic logical styles</h2>
</section>
<section>
<h2>Component-based web architecture</h2>
</section>
<!-- Last Slide -->
<section>
<h2>Thank you!</h2>
<h3>Una Kravets | @una</h3>
<small><ul>
<li>Photos from unsplash.com</li>
<li>Spec writing led by Miriam Suzanne</li>
</ul></small>
</section>
</div>
</div>
<script src="dist/reveal.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
transition: 'fade',
backgroundTransition: 'fade',
width: 1200,
height: 900,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
});
</script>
</body>
</html>