Tailwind CSS Course
Tailwind CSS
/
Beginner

Align Items

Definition

Utilities for controlling how flex and grid items are positioned along a container's cross axis.

Explain Like I'm New

If your flexbox is a horizontal row, `items-*` controls the Top-to-Bottom spacing. If you have a giant 100px tall button, and a tiny 12px text label next to it, `items-center` ensures they vertically align perfectly in the middle.

Real World Example

Centering a user's name vertically so it lines up perfectly with the middle of their circular profile picture.

Common Use Cases

  • •Vertical centering
  • •Stretching items to match height

Interactive Example

Interview Questions

basic

  • What Tailwind class vertically centers items in a standard `flex-row` container?

intermediate

  • What is the default `align-items` behavior if you don't specify anything?

Flash Cards

Question

Vertically centers?

Click to reveal answer
Answer

`items-center`

Question

Default behavior?

Click to reveal answer
Answer

`items-stretch`. By default, flex children will stretch vertically to perfectly match the height of the tallest child in the row.