Skip to content

FlashcardNot attempted

Flexbox vs Grid

Recall it before you reveal

When do you reach for flexbox and when for grid?

Space to reveal
Show answer & explanation

Flexbox is one-dimensional and content-out: items size themselves and you distribute leftover space along one axis. Good for navbars, toolbars, centering, and pushing something to the end (margin-left: auto).

Grid is two-dimensional and layout-in: you define rows/columns and place items. Good for page layouts (grid-template-areas), card galleries (repeat(auto-fill, minmax(...))), and anything that must align across rows. They compose: grid for the page, flex inside the cards.