Smashing Workshop
imposing structure on the page
workshops.oddbird.net/smash24/grid/
.grid-span { width: percentage( /* 23.7288136% */ ((3 * 4em) + (2 * 1em)) / ((12 * 4em) + (11 * 1em)) ); margin-right: percentage( /* 01.6949153% */ 1em / ((12 * 4em) + (11 * 1em)) ); padding-left: percentage( /* 08.4745763% */ ((1 * 4em) + (1 * 1em)) / ((12 * 4em) + (11 * 1em)) ); }
display: grid; grid-template-columns: repeat(12, 1fr); gap: 1em;
display: grid
gap
grid-<axis>-start
grid-<axis>-end
<rows>
<columns>
min-content
1fr
fit-content(
<limit>
)
clamp(auto, max-content,
repeat(
<count>, <tracks>
demo:
minmax(<min>, 1fr)
<min>
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)
contain: size | layout | style | paint;
Block boxes get their inline-size from Context (extrinsic).
inline-size
— Me, Monday
Block boxes get their block-size from Content (intrinsic).
block-size
size
container-type: inline-size;
contain
: inline-size layout style;
main { container: layout main / inline-size; }
container-name
/ container-type
@container layout (min-width: 40em) { .conditional { /* … */ } } @container main (min-width: 40em) { .conditional { /* … */ } }
(That would introduce loops!)
(can’t change what you measure!)
No element to measure…
body > :is(header, main, footer, aside) { container: layout / inline-size; }
cqw | cqh | cqi | cqb | cqmin | cqmax
cqw
cqh
cqi
cqb
cqmin
cqmax
@container style(--colors: invert) { … }
Unless you query a specific container-name
* for now ** ** but maybe forever?
@container state(stuck) { … } @container state(snapped) { … } @container state(overflowing) { … }
Navigate slides using the arrow-keys.