Lay out one-dimensional groups.
- main and cross axes
- gap
- justify-content
- align-items
- flex-grow
- flex-basis
- wrapping
Build responsive navigation and a row of equal-height cards.
- Open the result in a browser and inspect the HTML and computed CSS.
- Test at narrow and wide widths and use the keyboard for interactive elements.
- Write down one thing you changed after testing.
Flexbox arranges children along one main axis. justify-content distributes space on that axis; align-items works across it. flex-basis supplies a starting size, grow shares positive space, shrink handles shortage, and flex-wrap permits new lines. Gap creates consistent space between items. Use Flexbox for rows or columns whose contents determine their dimensions.
Using margin on every child can make edge spacing inconsistent. Remember that changing flex-direction also changes which axis is main.
Make a navigation row that wraps and cards that become one column on small screens. Inspect flex-basis and grow in developer tools.
- Rebuild the core idea without copying the example line by line.
- Explain the key HTML or CSS choice in your own words.
- Test the result at a narrow width and with keyboard navigation where relevant.
Open example.html in a browser. Edit style.css, save, and refresh.
Try: Change flex-basis from 12rem to 18rem and resize the browser.