Web Directions
Distributing content, and providing structure
workshops.oddbird.net/wd24/layout/
CSS takes a source document organized as a tree of elements… and text nodes… and renders it onto a canvas such as your screen.
— CSS Display Module Level 4
display
primarily inside and outside modes
inline-size
block-size
display: contents
writing mode
direction
width
height
top
block-start
bottom
block-end
left
inline-start
right
inline-end
margin-right
margin-inline-end
input { margin-inline-end: 1em; margin-left: 0; }
Block axis comes first
Which axis are we manipulating?
stretch
start
center
end
self-*
flex-*
block
block flow
inline
inline flow
grid
block grid
flex
block flex
table
block table
Create a Block Formatting Context
.defaults { flex-basis: auto; /* starting width */ flex-shrink: 1; /* distribution factor */ flex-grow: 0; /* distribution factor */ }
initial | auto | none | <grow>
initial
auto
none
<grow>
Initial
Same as 0 1 auto
0 1 auto
Auto
Same as 1 1 auto
1 1 auto
None
Same as 0 0 auto
0 0 auto
<number>
Same as <number> 1 0
<number> 1 0
place-
self
Explicit on each element
items
A default from the container
content
space
-between
-around
-evenly
Not a strict rule, just a hint!
display: grid
Generate columns & rows as needed
columns
rows
grid-<axis>-start
grid-<axis>-end
<rows>
<columns>
min-content
1fr
fit-content(
<limit>
)
clamp(auto, max-content,
repeat(
<count>, <tracks>
with matching *-start & *-end names
*-start
*-end
as column or row template
Content Expands & Contracts ??
Container queries will never be possible on the web. They would cause infinite layout loops.
— Browsers, a paraphrase (circa 2020)
Navigate slides using the arrow-keys.