liveBook · Manning

Alignment keywords

As explained in Web Design Playground

A CSS alignment keyword that places content or a gradient origin at the midpoint of the available space.

Alignment keywords tell a CSS Flexbox container where to place its items. The center value gathers them in the middle instead of at the start or end. section 12.2

Choose the property that matches the direction you want to control:

  • Use justify-content to arrange items along the main axis. section 12.2
  • Use align-items to arrange items along the cross axis. section 12.2
  • Set the value to center when the items belong in the middle of that axis. section 12.2

Center a row of items

container { display: flex; justify-content: center; } This places the flex items in the middle along the container's main axis. To center them along the cross axis too, add align-items: center.

How Web Design Playground covers it

How deep it goes
Explains center through axis-based placement and declarations, while stopping short of detailed layout internals.
Examples
Uses Flexbox containers with center applied through justify-content or align-items.
What it assumes
Assumes a basic CSS container and introduces the distinction between main-axis and cross-axis arrangement.
What you can do after
Apply center through named Flexbox properties to place items in the middle of a container axis.
How it connects
Connects alignment keywords with Flexbox, justify-content, align-items, main axis, and cross axis.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground. The section links point to the parts of the book it draws on.