Stop guessing CSS. See every axis.
Switch between Flexbox and CSS Grid, adjust alignment and gaps in real time, copy clean production CSS, and solve eight layout puzzles built for modern responsive interfaces.
- Flexbox explorer
- CSS Grid explorer
- 8 graded puzzles
1. Layout Engine
.container {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 12px;
}Live Stage
When to reach for Flex, and when to reach for Grid
Choose Flexbox for one-dimensional flow: navigation bars, button rows, icon-plus-label pairs, and wrapping tag pills. Flex excels when the content's own width should help decide spacing.
Choose CSS Grid for two-dimensional structure: course catalogues, dashboard panels, pricing comparisons, and sidebar-plus-main shells. Grid lets you define columns first with 1fr and minmax() so cards line up neatly without extra wrapper divs.
Combine them freely: a page shell can use Grid for its columns while the navbar inside the header uses Flexbox.
Why 1fr beats percentages: setting width: 33.33% breaks as soon as you add a gap: 16px, forcing horizontal scrollbars on phones. Grid's 1fr subtracts the gap first and shares only the leftover track cleanly.
Why alignment properties sometimes do nothing
Missing container height: align-items: center moves items along the vertical axis, so if the container is only as tall as its children, there is no spare room to centre within.
Axis swap on flex-direction: column: when you switch to column, justify-content controls vertical spacing and align-items controls horizontal alignment — the exact opposite of row mode.
Overflow on small Android phones: pair flex-wrap: wrap or minmax(220px, 1fr) with gap so three-column desktop cards stack cleanly into one column on 360px screens without forcing users to pinch-zoom.
Test your layouts in code: take any snippet you copy here into CEA Code Studio or study layout fundamentals in our Web Design course.
Next step
Turn layout skills into client-ready interfaces.
CEA Web Design teaches typography, responsive Flexbox/Grid systems, Figma wireframing and accessible UI craft across guided projects.
Admissions open · Two sessions a week · 24 Ebony Road, Port Harcourt