Alignment classes on grid-x map to flexbox: align-middle, align-bottom, align-justify, align-spaced, and align-center control cross-axis and main-axis distribution of cells.
Common patterns
- Logo + nav row:
grid-x align-justify align-middle - Vertically centered hero copy beside media:
align-middleon the row - Footer links spread edge to edge:
align-justify
These mirror flexbox alignment properties. Inside a single cell, you can also use text helpers (text-center) without changing flex behavior on the row.
Important interview questions and answers
- Q: Where do alignment classes go—cell or grid-x?
A: Ongrid-x(the flex container) for distributing cells; on inner markup for text alignment within one cell. - Q: align-justify vs align-spaced?
A:align-justifypushes first/last cells to edges with space between;align-spacedadds equal space around each cell including ends.
Self-check
- Which classes vertically center all cells in a row?
- When would
align-rightongrid-xbeattext-righton a paragraph?