CSS place-content Property

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The place-content property is a shorthand for align-content and justify-content. It packs or distributes content along the block and inline axes in a flex or grid container.

One value sets both axes (when valid for both). Two values set block first, then inline. It is not place-items, which aligns each item inside its cell.

Standard-track.

Not deprecated. Baseline widely available. Needs spare space in the container to show a visible change.

CSS Syntax

syntax.css
place-content: <align-content> <justify-content>? | initial | inherit;

First value → align-content. Optional second value → justify-content. If the second is omitted, the first is used for both when it is valid for both.

Property Values

ValueDescriptionTry it
centerPack content in the middle of both axesTry it
start endBlock axis start; inline axis endTry it
space-betweenFirst and last flush to edges; equal gaps betweenTry it
space-evenlyEqual space before, between, and after tracksTry it
initialResets to normal (like stretch in grid/flex)Try it
inheritTakes the parent’s place-contentTry it

How to Use place-content

Make a flex or grid container larger than its content, then pick how the content sits in the leftover space.

  1. Set display: grid or display: flex on the container.
  2. Give the box a size larger than its tracks or flex lines (width and/or height).
  3. On flex, set flex-wrap: wrap when you need more than one line for the block axis.
  4. Set place-content on the container. It is not inherited.
PieceRequired?Role
Flex or grid containerYesThe box whose content you are packing
Spare spaceYesWithout leftover space, keywords look the same
flex-wrap: wrapFlex (for lines)Creates extra flex lines for align-content
One or two keywordsYesOne value for both axes, or block then inline

Live Preview

A 2×2 grid of fixed tracks inside a larger box. Change only place-content.

Tracks are smaller than the box. Spare space is what place-content uses.

Grid
A
B
C
D

place-content: center — Packed in the middle on both axes.

CSS Examples

Each snippet focuses on place-content. Use Try It Yourself for a live editor.

Example 1 — Center Both Axes

One value centers the grid tracks vertically and horizontally.

CSS
<style>
  section {
    display: grid;
    grid-template-columns: 60px 60px;
    width: 220px;
    height: 160px;
    place-content: center;
    border: 1px solid #ccc;
  }
</style>

<section>
  <div>A</div>
  <div>B</div>
  <div>C</div>
  <div>D</div>
</section>
Try It Yourself

How It Works

  1. Make a grid. Two fixed columns create a 2×2 track group that is smaller than the box.
  2. Leave spare space. width and height are larger than those tracks.
  3. Use one keyword. place-content: center sets both align-content and justify-content to center.
  4. See the cluster. The four cells sit as a group in the middle. Items inside each cell are not centered by this property.

Example 2 — Two Different Axes

First value is the block axis. Second value is the inline axis.

CSS
<style>
  section {
    display: grid;
    grid-template-columns: 60px 60px;
    width: 220px;
    height: 160px;
    place-content: start end;
    border: 1px solid #ccc;
  }
</style>

<section>
  <div>A</div>
  <div>B</div>
  <div>C</div>
  <div>D</div>
</section>
Try It Yourself

How It Works

  1. Keep the same grid. Track size and box size match Example 1 so only the shorthand changes.
  2. Read left to right. start is align-content (top in a horizontal writing mode).
  3. Second keyword is inline. end is justify-content (right in LTR).
  4. Result. The track group hugs the top-right corner of the container.

Example 3 — Space Between

One distribution keyword applies to both axes.

CSS
<style>
  section {
    display: grid;
    grid-template-columns: 60px 60px;
    width: 220px;
    height: 160px;
    place-content: space-between;
    border: 1px solid #ccc;
  }
</style>

<section>
  <div>A</div>
  <div>B</div>
  <div>C</div>
  <div>D</div>
</section>
Try It Yourself

How It Works

  1. Same one-value rule. space-between is valid for both longhands, so both axes use it.
  2. Pin the edges. First and last tracks sit flush to the container edges on each axis.
  3. Share the leftover. Spare space sits between the tracks, not outside them.
  4. Compare with evenly. space-evenly also leaves equal gaps before the first and after the last track.

Edge Cases & Pitfalls

If the tracks do not move, one of these is usually why.

space

No spare space, no visible change

If the container is only as large as its content, every keyword looks the same. Give the box extra width and/or height.

flex

One flex line limits the block axis

With flex-wrap: nowrap, there is only one line, so the align-content half has nothing to pack. Set flex-wrap: wrap.

one-value

One value must be valid for both

If a single keyword is invalid for either longhand, the whole declaration is dropped. Prefer two values when mixing baseline and distribution keywords.

items

Not the same as place-items

place-items aligns each item in its cell. place-content moves the tracks (or flex lines) as a group.

order

Remember block then inline

place-content: start end is not the same as end start. First = align-content, second = justify-content.

Browser Support

place-content is a browser layout property for flex and grid. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available since Jan 2020

place-content

Chrome 59+, Firefox 45+, Safari 9+, Edge 79+, Opera 46+, Samsung Internet 7.2+. Internet Explorer has no support.

97% Modern browser support
Google Chrome 59+
Full support
Mozilla Firefox 45+
Full support
Apple Safari 9+
Full support
Microsoft Edge 79+
Full support
Opera 46+
Full support
Samsung Internet 7.2+
Full support
Internet Explorer No support
None
place-content Widely supported

Bottom line: Safe in current browsers. For Internet Explorer, set align-content and justify-content as separate longhands instead of the shorthand.

Key Takeaways

  • Role: shorthand for packing content on both axes (align-content + justify-content).
  • Common values: center, start end, space-between, space-evenly.
  • Initial value: normal. Not inherited.
  • Needs: leftover space (and wrapped flex lines when using flex).

One line: place-content aims the whole content group; place-items aims each item in its cell.

Frequently Asked Questions

It is a shorthand for align-content and justify-content. It packs or distributes the content tracks of a flex or grid container along the block and inline axes.
place-content aligns the overall content (tracks or flex lines) inside the container. place-items aligns each item inside its own cell or line.
A single value sets both align-content and justify-content, if that value is valid for both. For example, place-content: center centers on both axes.
The first value is align-content (block axis). The second is justify-content (inline axis). Example: place-content: start center.
The container needs leftover space, and flex needs more than one line (flex-wrap: wrap). Without spare space, every keyword looks the same.
It is Baseline and widely available since January 2020: Chrome 59+, Firefox 45+, Safari 9+, Edge 79+. Internet Explorer does not support it. It is a browser layout property, not a Node.js feature.

Next: place-items

Learn the shorthand that aligns items inside their cells.

place-items tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful