Skip to content

Commit 85b0d61

Browse files
committed
📝 improve section on flow layout
1 parent 828c932 commit 85b0d61

File tree

3 files changed

+82
-37
lines changed

3 files changed

+82
-37
lines changed

.prettierrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"tabWidth": 2,
3-
"useTabs": false
3+
"useTabs": false,
4+
"semi": false,
5+
"singleQuote": true
46
}

src/content/talks/2024/17-04/basic-css-layouts.mdx

Lines changed: 77 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ import HTMLSnippet from '@/components/HTMLSnippet.astro'
1111
import { Slide, Presentation, SlideOnly } from '@/components/slides'
1212
import BoxModelExample from '@/snippets/css-basic-layouts/BoxModelStandalone.astro'
1313

14-
1514
<Presentation />
1615

1716
<Slide centered>
1817
# ZOOOOOOM!
1918

2019
> Is everything big enough and are we in dark mode?
20+
2121
</Slide>
2222

2323
<Slide centered>
2424
# An Introduction to CSS Layouts
25+
2526
</Slide>
2627

2728
<Slide centered>
@@ -31,7 +32,9 @@ import BoxModelExample from '@/snippets/css-basic-layouts/BoxModelStandalone.ast
3132
- Selectors
3233
- Cascade
3334
- Box Model
35+
- Flow Layout
3436
- Debugging
37+
3538
</Slide>
3639

3740
<Slide>
@@ -89,7 +92,6 @@ ins={[
8992
/>
9093
</Slide>
9194

92-
9395
<Slide>
9496
# Combining Selectors (Combinators)
9597

@@ -132,12 +134,13 @@ del={
132134

133135
- Used by browser to determine the most relevant declaration
134136
- Based on the selector used
135-
- Type of selector, combinators used, and level of impact this
137+
- Type of selector, combinators used, and level of impact this
136138

137-
# Order
139+
# Order
138140

139141
- Where is the style in the stylesheet
140142
- Used to break ties in specificity
143+
141144
</Slide>
142145

143146
<Slide>
@@ -146,18 +149,12 @@ del={
146149
Rules for specificity are pretty tricky, but your IDE should show this to you when hovering over a class
147150

148151
<CSSSnippet
149-
path="css-basic-layouts/specificity.css"
150-
html
151-
htmlPath="css-basic-layouts/Specificity.astro"
152-
ins={
153-
{range: "1-2", label: "(1, 1, 0) - Most Specific"}
154-
}
155-
mark={[
156-
{range: "4-5", label: "(0, 1, 0) - Least Specific"},
157-
]}
158-
del={
159-
{range: "7-8", label: "(0, 2, 0)"}
160-
}
152+
path="css-basic-layouts/specificity.css"
153+
html
154+
htmlPath="css-basic-layouts/Specificity.astro"
155+
ins={{ range: '1-2', label: '(1, 1, 0) - Most Specific' }}
156+
mark={[{ range: '4-5', label: '(0, 1, 0) - Least Specific' }]}
157+
del={{ range: '7-8', label: '(0, 2, 0)' }}
161158
/>
162159

163160
</Slide>
@@ -166,13 +163,13 @@ del={
166163
# Impact of Specificity
167164

168165
<CSSSnippet
169-
path="css-basic-layouts/combinators.css"
170-
htmlPath="css-basic-layouts/Combinators.astro"
166+
path="css-basic-layouts/combinators.css"
167+
htmlPath="css-basic-layouts/Combinators.astro"
171168
/>
172169

173170
<CSSSnippet
174-
path="css-basic-layouts/specificity.css"
175-
htmlPath="css-basic-layouts/Specificity.astro"
171+
path="css-basic-layouts/specificity.css"
172+
htmlPath="css-basic-layouts/Specificity.astro"
176173
/>
177174

178175
</Slide>
@@ -182,6 +179,7 @@ htmlPath="css-basic-layouts/Specificity.astro"
182179

183180
- Used in addition to other selectors
184181
- Select an element based on DOM state
182+
185183
</Slide>
186184

187185
<Slide>
@@ -200,9 +198,9 @@ ins=":valid"
200198
</Slide>
201199

202200
<Slide>
203-
# The Box Model
201+
# The Box Model
204202

205-
> Rectangles all the way down
203+
> Rectangles all the way down
206204
207205
<CSSSnippet
208206
path="css-basic-layouts/box-model.css"
@@ -216,25 +214,65 @@ collapse="1-9"
216214
</Slide>
217215

218216
<Slide>
219-
# Block vs Inline Block
217+
# Layouts
218+
219+
- Layout influences how certain properties behave
220+
- Different Layout Modes at a parent level
221+
- Flow
222+
- Flex
223+
- Grid
224+
- Layout Modes at a child level
225+
- Relative
226+
- Absolute
227+
- Sticky
228+
- Static
229+
230+
> We'll talk about Flow
231+
232+
</Slide>
233+
234+
<Slide>
235+
236+
# Flow - Block vs Inline Block
220237

238+
- Block elements are placed top-to-bottom
239+
- Inline elements are placed left-to-right and wrap with reading width
240+
- Default layout Mode
221241
- Layout behaves and interacts differently
222242
- Sizing is calculated differently
223243
- Some properties will behave differently based on this
224244

245+
</Slide>
246+
247+
<Slide>
225248
<CSSSnippet
226-
path="css-basic-layouts/inline-v-block.css"
227-
htmlPath="css-basic-layouts/InlineVBlock.astro"
228-
mark={["23", "27", "31"]}
229-
collapse="1-21"
249+
path="css-basic-layouts/inline-v-block.css"
250+
htmlPath="css-basic-layouts/InlineVBlock.astro"
251+
mark={['23', '27', '31']}
252+
collapse="1-21"
230253
/>
231254

232255
</Slide>
233256

234257
<Slide>
235-
# Debugging
258+
# A Note on Layouts
259+
260+
- Flow is fairly restrictive but important to understand
261+
- Other layout modes are also important:
262+
- Display properties: Flex, Grid
263+
- Position properties: Relative, Absolute, Sticky, Static
264+
265+
</Slide>
266+
267+
<Slide>
268+
# Debugging
269+
270+
> Firefox has the best CSS Tooling (in general)
236271
237-
> Firefox has the best CSS Tooling (in general)
272+
- Hover tooltips
273+
- CSS Overrides
274+
- HTML Breakpoints
275+
- Flex and Grid Tools
238276

239277
<BoxModelExample />
240278
</Slide>
@@ -244,21 +282,26 @@ collapse="1-21"
244282

245283
> Well, you can just:
246284
247-
<HTMLSnippet path="css-basic-layouts/DebugCSSButton.astro" />
285+
<HTMLSnippet mark="7" path="css-basic-layouts/DebugCSSButton.astro" />
248286
</Slide>
249287

250-
251288
<Slide>
252-
# References
289+
# References
253290

254291
Anything by Josh W. Comeau pretty much
255292

256293
- [Understanding Layout Algorithms](https://www.joshwcomeau.com/css/understanding-layout-algorithms/)
257294
- [An Interactive Guide to CSS Grid](https://www.joshwcomeau.com/css/interactive-guide-to-grid/)
258295
- [An Interactive Guide to Flexbox](https://www.joshwcomeau.com/css/interactive-guide-to-flexbox/)
259296

260-
MDN
297+
MDN
261298

262299
- [CSS Syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax)
300+
- [Flow Layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flow_layout)
301+
- [Flex](https://developer.mozilla.org/en-US/docs/Web/CSS/flex)
302+
303+
CSS Tricks
263304

264-
</Slide>
305+
- [Guide to Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)
306+
307+
</Slide>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<button onclick="body.classList.toggle('desperation')"
1+
<button onclick="body.classList.toggle('debug-mode')"
22
>Give Everything a Red Border</button
33
>
44

55
<style>
6-
body.desperation * {
6+
body.debug-mode * {
77
border: red 1px solid;
88
}
99
</style>

0 commit comments

Comments
 (0)