CSS Portal

CSS place-content Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The place-content property defines how the collective content of a container is distributed along both the block and inline axes — in other words, it controls where the group of tracks or wrapped lines sits inside the container when there is extra space. It acts as a shorthand that sets the two orthogonal alignment axes together, combining the behaviors of align-content and justify-content. Because it targets the content as a whole rather than individual items, it's most relevant for multi-track or multi-line layout situations such as CSS Grid or a flex container with wrapping.

Understanding how place-content differs from per-item alignment is important. Properties like place-items, align-items, and justify-items affect how individual grid or flex items are positioned within their own grid area or flex line; by contrast, place-content moves or distributes the entire block of lines or tracks inside the container (for example pushing them to the start, centering them, or distributing leftover space between lines). It also interacts with the size of tracks and the container’s available space: when there is no extra space or when the content fills the container, changing place-content has little to no visible effect.

In practical layouts, place-content is useful for controlling overall composition — for centering a grid of items within a larger panel, for defining how wrapped flex lines fill a container, or for creating controlled gaps of free space around the group of tracks. Its behavior respects the document’s writing mode and logical axes, so the meaning of “inline” and “block” can flip in vertical or sideways writing modes. It also interacts with other layout settings such as track sizing and spacing (for example, the container’s gap between tracks) and with auto margins on children; use it when you want to handle grouping and distribution of content at the container level rather than adjusting alignment of each item individually.

Definition

Initial value
normal
Applies to
Multi-line flex containers
Inherited
No
Computed value
As specified
Animatable
No
JavaScript syntax
object.style.placeContent

Interactive Demo

One
Two
Three

Syntax

place-content: <align-content> <justify-content> ?

Values

Example

<div class="example">
<h2>place-content example</h2>
<div class="grid">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
</div>
<p class="note">CSS: place-content: center space-between;</p>
</div>
/* Container and demo layout */
.example {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  max-width: 760px;
  margin: 28px auto;
  padding: 8px;
}

h2 {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: #111827;
}

/* Grid demonstrating place-content */
.grid {
  height: 300px; /* extra space so align-content has visible effect */
  display: grid;
  grid-template-columns: repeat(3, 110px);
  grid-auto-rows: 56px;
  gap: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e6eef6;
  border-radius: 8px;

  /* place-content is a shorthand for align-content and justify-content */
  place-content: center space-between; /* vertical: center, horizontal: space-between */
}

.item {
  background: #2563eb;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}

.note {
  margin-top: 12px;
  color: #374151;
  font-size: 13px;
}

Browser Support

The following information will show you the current browser support for the CSS place-content property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!