Grandma Marni’s stall at the morning market: the table is a real flex container and her goods flex items, so set direction, justify and align, guess the…
Flexbox is the quickest way to build a one-dimensional layout (one row or one column). Most layout needs are met with display: flex and two or three properties. If you can master only one layout system, master Flexbox.
When the direction changes, the axes swap roles
justify-content: center Check flex-direction first. justify-content works on the MAIN axis. In a column the main axis is vertical, so its center is top-to-bottom, not left-to-right. For left-to-right, use align-items.flex-shrink: 1 by default. Put flex-shrink: 0 on items that must not shrink, or min-width: 0 when it is the content that should be allowed to shrink below its own size.align-items and align-content align-items places the items inside one line. align-content places the lines themselves when they wrap. Remember: items = what is in a line, content = the set of lines.justify-content: start → center → space-between The goods move along the main axis and the free space (the striped part) is shared out again. See packed left against spread out.flex-direction to column The main axis turns upright: justify-content now handles top and bottom, align-items left and right. The arrows on the table rim swap too.flex-wrap: wrap and put 8 goods out Goods that do not fit move down to a new row instead of squeezing. Then try align-content: it moves the rows.flex-grow: 1 Its mat unrolls into the free space. flex: 1, the shorthand you will often see, also gives flex-grow: 1, plus flex-basis: 0.