Justify Items Property

Last updated: 2026-09-13

justify-items Justify Items Property

The justify-items property sets the default alignment of all items in the inline (row) axis inside the container. It applies mainly to grid layouts and has no effect in flexbox. It is the per-item counterpart of justify-content: it aligns each item within its own grid cell rather than the items as a group. Its default value is stretch, which stretches the items to fill the cell.

Category
Initial Valuelegacy
InheritedNo
Applies To
Animation Type
CSS VersionCSS3
StatusStandard

📝 Syntax

justify-items: normal | stretch | start | end | self-start | self-end | center | left | right | baseline | legacy;

⚙️ Values

ValueTypeDescription
normal | stretch | start | end | center | left | right | legacyKeywordInline axis alignment of items

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
justify-items v29 v12 v28 v9 v17
Supported in all major browsers
Warning: justify-items has no effect in flexbox; it only applies to grid. In a flex layout, use justify-content to align the items.
Tip: The legacy value of justify-items exists for compatibility with older browsers and is meant to be paired with justify-self: legacy. New projects should avoid it.

❓ FAQ

QWhat is the difference between justify-items and justify-content?
Ajustify-items acts on each grid item and controls how the item is aligned inside its own cell along the inline (horizontal) axis. justify-content acts on the whole grid content area and controls how the tracks are distributed inside the container. The two levels are independent and can be combined: justify-content distributes the container’s leftover space, while justify-items aligns each item within its cell.
QWhy doesn’t justify-items work in flexbox?
AFlexbox has no concept of grid cells; the items are placed directly in the container, so justify-items has nothing to apply to. In flexbox, use justify-content to distribute the items along the main axis and align-items to align them on the cross axis. The same applies to align-items and align-self: they serve grid on the block axis and also work in flex, while the justify-* pair is grid-only. justify-items and its per-item form justify-self mainly serve grid layouts.
QHow do I center the content of every grid cell horizontally?
ATwo ways: write justify-items: center on the container to center every grid item horizontally in its cell, or write justify-self: center on a single item. Do not use justify-content: center here - it positions the entire grid content area inside the container. Also remember that the default justify-items: stretch makes the item fill the whole cell, so centering takes effect only once the item is no longer stretched; start or center values let the item shrink to its content width first. To center vertically at the same time, use place-items: center.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏