Foreman-level Flexbox: 8 advanced levels of flex-basis, flex-grow vs flex-shrink and gap. An advanced Flexbox game for Flexbox Ducks graduates.
flex-grow controls how much a flex item grows to fill empty space. A value of 1 = share the space equally. A value of 2 = take a 2x larger portion.
flex-shrink controls the shrinking when there isn't enough space. A value of 0 = never shrink. flex-basis sets the initial size before grow/shrink is applied.
The flex shorthand combines flex-grow, flex-shrink and flex-basis. flex: 1 = flex: 1 1 0%. flex: 0 0 200px = a fixed 200px.
gap adds spacing between flex/grid items without margin. Cleaner because there's no double margin and no need for :first-child/:last-child hacks.
.col stalls are only as wide as their goods. Share the leftover road evenly: give every .col flex-grow: 1.#sidebar flex-grow: 1 and #main flex-grow: 3: the leftover road is split in four, one part for #sidebar, three for #main.#sidebar bread table is 200px long and cannot fold, and the road is narrow here. Give #sidebar flex-basis: 200px and flex-shrink: 0.flex: 0 0 200px on #sidebar (grow 0, shrink 0, basis 200px) and flex: 1 on #main.#container are pressed together and buyers cannot get through. Give #container gap: 16px so there is an aisle between stalls.#grid flex-wrap: wrap and every .card flex: 0 0 calc(50% - 8px), so the stalls move down to the next row, two by two.#logo name board and the #actions ticket booth must not shrink (flex-shrink: 0), the #nav signpost fills the leftover road (flex-grow: 1).#left table and the #right rack stay 200px (flex: 0 0 200px), the #center stall takes the rest (flex: 1). The container is already display: flex.