align-items

W3C CSS Snapshot 2026

Set the default block-axis alignment of items within their cells.

On this page

Syntax and values

Value or syntaxWhat it does
normalBehaves like stretch for most auto-sized grid items. Items with an intrinsic size or aspect ratio normally align to start.
stretchFills the cell along the alignment axis when the item’s size on that axis is auto.
start / end / centerAligns the item at the logical start, end, or center of its cell.
self-start / self-endUses the item’s writing direction for the aligned edge.
baseline / first baseline / last baselineAligns first or last text baselines. baseline is the first-baseline form.
safe center / unsafe centerThe safe modifier falls back to start when centering would cause overflow. Unsafe keeps the requested alignment. These modifiers apply to supported positional values.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>align-items example</title>
  <style>
.layout { display: grid; width: min(100%, 320px); border: 2px solid teal; box-sizing: border-box; }
.layout > div { padding: 8px 12px; background: #def5f5; color: #123; border: 1px solid #81b9b5; box-sizing: border-box; }
.layout { grid-template-columns: 1fr 1fr; grid-template-rows: 60px 60px; }
.layout { align-items: center; }
  </style>
</head>
<body>
<div class="layout">
  <div class="first">A</div>
  <div class="second">B</div>
  <div>C</div>
</div>
</body>
</html>

What to expect Each tile is centered vertically in its cell in this writing mode.

Official references