justify-items

Defines the default alignment for all items inside a grid container along the inline (horizontal) axis.

It is documented as part of the CSS Box Alignment specification.

/* Usage Example */
.grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Centers all children horizontally within their grid cells */
  justify-items: center;
}

/* Syntax */
justify-items: normal;
justify-items: stretch;
justify-items: left;
justify-items: right;
justify-items: legacy;
justify-items: center;
justify-items: anchor-center;

/* Global values */
justify-items: inherit;
justify-items: initial;
justify-items: revert;
justify-items: revert-layer;
justify-items: unset;
Widely available Since 2015 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

52+
20+
9+
12+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC