wtf(css)layout you can see happening

CSS, with the layout showing

Forty steps through flexbox, twenty-two builds that fail unless several concepts are right at once, and the famous wtfs underneath — margin collapsing, stacking contexts, and the invisible wall inside every flex item. This is the one subject where the output IS the picture, so every problem is rendered rather than described.

Problems

49 problems
#titletopictypedifficulty
1display: flex changes the children, not the boxMaking a flex containerTeaching stepEasy
2flex-direction: column swaps which axis is whichMain axis vs cross axisTeaching stepEasy
3justify-content is the main axis, align-items is the cross axisAlignmentTeaching stepEasy
4align-items: stretch is the defaultAlignmentTeaching stepEasy
5align-self overrides the containerAlignmentTeaching stepEasy
6justify-content distributes free space — and sometimes there is noneDistributing spaceTeaching stepEasy
7flex-grow distributes the surplus, not the containerSizingTeaching stepEasy
8flex-shrink: 0 is defensive CSSSizingTeaching stepEasy
9gap spaces items without touching themGapTeaching stepEasy
10flex-wrap: wrap turns one line into manyWrapping and the align-content trapTeaching stepEasy
11The mystery gap under an imageThe famous WTFsExplain the wtfEasy
12The whitespace between inline-block elementsThe famous WTFsExplain the wtfEasy
13Centre the brand mark in the mastheadAlignmentBuild itEasy
14Centre the hero card — in a container that runs downwardsMain axis vs cross axisBuild itEasy
15Centre the unread count inside its pillAlignmentBuild itEasy
16Centre the empty-state message in the results panelAlignmentBuild itEasy
17Centre the glyph in the round action buttonAlignmentBuild itEasy
18Sit the editor tools in the middle of the railAlignmentBuild itEasy
19Float the pinned tag to the front of the listOrderBuild itEasy
20Hold the terminal output at the bottom — in the order it was writtenDistributing spaceBuild itEasy
21Newest activity at the top, list still hugging the topMain axis vs cross axisBuild itEasy
22Flip your own chat messages to the rightMain axis vs cross axisBuild itEasy
23Reverse the wizard steps — and keep them on the leftMain axis vs cross axisBuild itEasy
24Drop the chips so they stack up from the floorMain axis vs cross axisBuild itEasy
25The same dialog footer, and now they have to sit at the bottomAlignmentBuild itEasy
26Send the destructive button to the far end of the toolbarDistributing spaceBuild itEasy
27Pin both team badges to the edges and centre the clockDistributing spaceBuild itEasy
28Push the close button to the far edge of the modal headerDistributing spaceBuild itEasy
29Move the whole dialog button row to the trailing edgeDistributing spaceBuild itEasy
30Render Cancel before Save without touching the markupOrderBuild itEasy
← Prev12Next →

44 of 87 catalogue topics are authored, with 37 drills rehearsing them. Every one of them is judged: each carries a starter that has been shown to fail, at least two different correct answers that have been shown to pass, and a set of near-misses and cheats that have been shown to be caught. Nothing reaches this list until all of that holds.