The place-items property is a shorthand for align-items and justify-items. It aligns each item inside its own grid cell or flex area.
01
Shorthand
Two in one.
02
Grid Cells
Per-item align.
03
center
Common value.
04
stretch
Default-like.
05
Two Values
Block + inline.
06
Flexbox
Also supported.
Fundamentals
Introduction
The place-items property in CSS is a shorthand for setting both the align-items and justify-items properties in a grid or flex container.
This property simplifies the alignment of grid items or flex items within their container, allowing for cleaner and more concise code. It helps control the positioning of items both horizontally and vertically inside their areas.
Definition and Usage
Use place-items when every child should follow the same alignment rule inside its cell. This is different from place-content, which moves the entire track group inside the container.
A single value such as center is one of the most common patterns for icon buttons, cards, and centered content blocks in grid layouts.
💡
Beginner Tip
If one small box should sit in the middle of a grid cell, use place-items: center on the container instead of margins on the child.
Foundation
📝 Syntax
The syntax for the place-items property is as follows:
syntax.css
element{place-items:align-itemsjustify-items;}
Here, align-items and justify-items control alignment along the block and inline axes. You can set both values at once with this shorthand.
Basic Example
place-items.css
.container{display:grid;place-items:center;}
Syntax Rules
One value sets both align-items and justify-items.
Two values set block axis first, then inline axis.
Works on grid containers and flex containers.
Best for aligning items inside cells, not moving whole track groups.
Common values include start, center, end, and stretch.
Use place-self when only one child needs a different alignment.
Defaults
🎯 Default Value
The initial value of place-items follows align-items and justify-items. In grid layouts, this typically behaves like stretch on both axes, so items expand to fill their cells unless you set another value.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Shorthand for
align-items + justify-items
Applies to
Grid and flex containers
Inherited
No
Animatable
No
Common use
Center or align all items inside their cells
Reference
💎 Property Values
place-items accepts the same values as align-items and justify-items.
align-items values (block axis)
start — Align items to the start of the block axis.
center — Align items to the center of the block axis.
end — Align items to the end of the block axis.
stretch — Stretch items to fill the container along the block axis.
justify-items values (inline axis)
start — Align items to the start of the inline axis.
center — Align items to the center of the inline axis.
end — Align items to the end of the inline axis.
stretch — Stretch items to fill the container along the inline axis.
Value
Example
Description
center
place-items: center;
Centers every item inside its cell on both axes.
stretch
place-items: stretch;
Stretches items to fill available cell space where supported.
two values
place-items: start end;
Sets block-axis alignment first, then inline-axis alignment.
centerstretchstartendstart end
Context
When Does place-items Matter?
place-items is ideal when each child should align consistently inside its own area:
Centered icons — Put icons or avatars in the middle of square grid cells.
Dashboard tiles — Align card content uniformly across a grid.
Form controls — Center labels or buttons inside fixed-size cells.
Less CSS noise — Replace two longhand properties with one declaration.
If the whole grid should move inside a larger container, use place-content instead.
Preview
👀 Live Preview
Compare place-items: stretch with place-items: center inside the same-sized cell.
stretch
center
Hands-On
Examples Gallery
Start with a centered grid item, align multiple cells, try two-value syntax, and use flexbox.
▦ Grid Item Alignment
Use place-items on grid containers — matching the reference example.
Example 1 — Centered Grid Item
In this example, we’ll use the place-items property to center items both horizontally and vertically within a grid container.
Grid or flex layout divides space into areas for child items.
display: grid
2
You set place-items
One or two keywords define alignment inside every cell.
CSS rule
3
Each item is positioned in its area
Items move within their own track space according to the chosen alignment.
Layout engine
=
▦
Consistent item alignment
Every child follows the same centering or stretching rule with minimal CSS.
Compatibility
Browser Compatibility
The place-items property is supported in most modern browsers. It is generally compatible with the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, older browser versions may not fully support this property, so testing across different browsers is recommended to ensure consistent behavior.
✓ Grid & Flex · Modern support
Reliable place-items support
Chrome, Firefox, Safari, Edge, and Opera support place-items for grid and flex layouts.
96%Modern browser support
Google Chrome59+ · Desktop & Mobile
Full support
Mozilla Firefox45+ · Desktop & Mobile
Full support
Apple Safari11+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera46+ · Modern versions
Full support
Testing tip
Test grid and flex examples separately in your target browsers, especially when using two-value syntax.
place-items property96% supported
Bottom line:place-items is widely available in modern browsers and is safe for grid-centered UI patterns.
Wrap Up
Conclusion
The place-items property is a convenient shorthand for aligning grid or flex items along both the block and inline axes.
By using this property, you can simplify your CSS and achieve precise alignment with minimal code. Experiment with different values to see how they affect the layout and alignment of your items, and incorporate this property to enhance the design and functionality of your web projects.
Use place-items: center for quick cell centering in grids
Prefer shorthand when both axes share the same alignment
Give grid cells enough size to see alignment effects clearly
Use place-self for one-off item overrides
Pair with explicit grid-template-columns for dashboards
❌ Don’t
Confuse place-items with place-content
Expect place-items to move the whole grid inside a parent
Rely on stretch when items should keep intrinsic size
Forget that flex and grid may interpret axes differently
Override every item manually when one container rule is enough
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about place-items
Use these points when aligning items inside grid and flex areas.
5
Core concepts
▦01
Shorthand
align + justify items.
Purpose
⚙02
stretch Default
Typical grid behavior.
Default
◉03
center
Most common value.
Pattern
↔04
Per Cell
Not whole tracks.
Scope
pc05
place-content
Different shorthand.
Related
❓ Frequently Asked Questions
place-items is a shorthand that sets align-items and justify-items together. It controls how each item is aligned inside its grid cell or flex line.
place-items aligns individual items inside their cells. place-content aligns the whole group of tracks or lines within the container.
Yes. place-items works on flex containers and grid containers. On flex, it mainly affects align-items and justify-items behavior for items.
A single value applies to both align-items and justify-items. For example, place-items: center centers every item in its cell on both axes.
The initial value follows align-items and justify-items. In grid layouts this typically behaves like stretch on both axes unless you set something else.