CSS place-content Property

Beginner
⏱️ 7 min read
📚 Updated: Jun 2026
🎯 4 Examples
Grid & Flexbox

What You’ll Learn

The place-content property is a shorthand for align-content and justify-content. It aligns and distributes content inside grid and flex containers.

01

Shorthand

Two in one.

02

Grid

Track alignment.

03

Flexbox

Wrapped lines.

04

center

Common value.

05

space-*

Distribute gaps.

06

Two Values

Block + inline.

Introduction

The place-content property in CSS is a shorthand property used to align and distribute content within a container. It combines the functionality of align-content and justify-content properties into one.

This property is particularly useful for controlling the alignment of items along both the block and inline axes in a grid or flex container.

Definition and Usage

Use place-content when you want to position the whole group of tracks or flex lines inside a container that has extra space. It does not replace place-items, which aligns items inside their own cells.

A single value such as center applies to both axes. Two values let you set block-axis and inline-axis alignment separately.

💡
Beginner Tip

Need one box in the middle of a grid area? place-content: center on the container is often the quickest solution.

📝 Syntax

The place-content property can accept one or two values. When two values are provided, the first value applies to the block axis (vertical alignment in horizontal writing modes), and the second value applies to the inline axis (horizontal alignment).

syntax.css
element {
  place-content: align-content justify-content;
}
  • align-content — Specifies the alignment of the content along the block axis.
  • justify-content — Specifies the alignment of the content along the inline axis.

Basic Example

place-content.css
.container {
  display: grid;
  place-content: center;
}

Syntax Rules

  • One value sets both align-content and justify-content.
  • Two values set block axis first, then inline axis.
  • Works on grid containers and flex containers with wrapped content.
  • Most useful when the container is larger than its content tracks or lines.
  • Do not confuse with place-items, which targets item alignment inside cells.
  • Distribution keywords like space-between need extra free space to show an effect.

🎯 Default Value

The initial value of place-content follows its longhand properties: align-content: normal and justify-content: normal. If you provide only one value, it is used for both axes.

⚡ Quick Reference

QuestionAnswer
Shorthand foralign-content + justify-content
Applies toGrid and flex containers
InheritedNo
AnimatableNo
Common useCenter or distribute content tracks in a container

💎 Property Values

place-content accepts the same values as align-content and justify-content.

ValueExampleDescription
startplace-content: start;Aligns the content to the start of the container along the respective axis.
endplace-content: end;Aligns the content to the end of the container along the respective axis.
centerplace-content: center;Centers the content along the respective axis.
space-betweenplace-content: space-between;Distributes the content evenly with space between the items along the respective axis.
space-aroundplace-content: space-around;Distributes the content evenly with space around the items along the respective axis.
space-evenlyplace-content: space-evenly;Distributes the content evenly with equal space around and between the items along the respective axis.
stretchplace-content: stretch;Stretches the content to fill the container along the respective axis where supported.
center space-between space-evenly start end

When Does place-content Matter?

place-content shines when a container has unused space around its tracks or wrapped lines:

  • Centered layouts — Put a small grid or flex group in the middle of a large area.
  • Dashboard shells — Distribute rows or columns with space-between.
  • Card grids — Spread tracks evenly with space-evenly.
  • Shorter syntax — Replace two longhand properties with one declaration.

If you only need to align one item inside its cell, use place-items instead.

👀 Live Preview

Compare place-content: start with place-content: center on the same two-item grid.

start

1
2

center

1
2

Examples Gallery

Start with centered grid content, try mixed axis values, use flexbox, and distribute tracks with space-evenly.

▦ Grid Alignment

Use place-content on grid containers — matching the reference examples.

Example 1 — Centered Grid Content

In this example, we align the content of a grid container to the center both vertically and horizontally.

place-content-center.html
<style>
  .container {
    display: grid;
    height: 200px;
    place-content: center;
    border: 2px solid #333;
  }

  .item {
    background-color: #ff5733;
    color: #fff;
    padding: 20px;
  }
</style>

<div class="container">
  <div class="item">Centered Item</div>
</div>
Try It Yourself

How It Works

One keyword, center, sets both align-content and justify-content, placing the grid’s content group in the middle of the container.

Example 2 — Space Between and Center

Use place-content: space-between center; to distribute content evenly with space between items vertically and center them horizontally.

place-content-space-between.html
<style>
  .container {
    display: grid;
    height: 200px;
    place-content: space-between center;
    border: 2px solid #333;
  }
</style>

<div class="container">
  <div class="item">Item 1</div>
  <div class="item">Item 2</div>
</div>
Try It Yourself

How It Works

The first value controls the block axis (space-between pushes rows apart). The second value centers the group on the inline axis.

🔀 Flexbox & Distribution

Apply place-content to flex layouts and multi-track grids.

Example 3 — Centered Flex Content

On a wrapping flex container, place-content: center groups flex lines in the middle of the available space.

place-content-flex.html
<style>
  .container {
    display: flex;
    flex-wrap: wrap;
    place-content: center;
    height: 12rem;
  }
</style>
Try It Yourself

How It Works

Flex lines behave like content tracks. With extra vertical and horizontal space, place-content: center pulls the wrapped group toward the middle.

Example 4 — Space Evenly on a Grid

Use place-content: space-evenly to spread rows and columns with equal gaps around and between tracks.

place-content-space-evenly.html
<style>
  .container {
    display: grid;
    grid-template-columns: repeat(2, 5rem);
    grid-template-rows: repeat(2, 3.5rem);
    height: 14rem;
    place-content: space-evenly;
  }
</style>
Try It Yourself

How It Works

Because the grid tracks are smaller than the container, space-evenly adds balanced free space on both axes.

place-content vs align-content and justify-content

place-content is shorthand for align-content (block axis) and justify-content (inline axis).

It is related to but different from place-items, which aligns items inside cells rather than the content tracks as a whole.

shorthand-vs-longhand.css
/* Shorthand */
.container {
  place-content: space-between center;
}

/* Longhand equivalent */
.container {
  align-content: space-between;
  justify-content: center;
}

🧠 How place-content Works

1

Container has extra space

A grid or flex container is larger than its tracks or wrapped lines.

Free space
2

You set place-content

One or two keywords decide alignment and distribution on each axis.

CSS rule
3

Tracks move as a group

The browser positions or spreads the content tracks inside the container.

Layout engine
=

Aligned layout group

Content sits centered, pushed to an edge, or distributed with even spacing.

Browser Compatibility

The place-content property is well-supported in modern browsers. However, always check the latest compatibility tables to ensure that it works as expected across different browsers and their versions.

Grid & Flex · Modern support

Reliable place-content support

Chrome, Firefox, Safari, Edge, and Opera support place-content for grid and flex layouts.

96% Modern browser support
Google Chrome 59+ · Desktop & Mobile
Full support
Mozilla Firefox 45+ · Desktop & Mobile
Full support
Apple Safari 11+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 46+ · Modern versions
Full support

Testing tip

Verify both grid and flex use cases in your target browsers, especially when mixing space-* values with fixed track sizes.

place-content property 96% supported

Bottom line: place-content is widely available in modern browsers for grid and flexbox layouts.

Conclusion

The place-content property is a versatile tool for aligning and distributing content within a container.

By combining the capabilities of align-content and justify-content, it allows for easy and precise control over the layout of grid and flex items. Experiment with different values to achieve the desired alignment and distribution in your web projects.

💡 Best Practices

✅ Do

  • Use place-content: center for quick whole-group centering
  • Prefer shorthand when both axes use related alignment
  • Give the container explicit height or width so free space exists
  • Use two values when block and inline axes need different behavior
  • Pair with grid or wrapping flex for best results

❌ Don’t

  • Confuse place-content with place-items
  • Expect distribution keywords to work without extra free space
  • Use place-content when you only need one item centered in a cell
  • Forget that flex needs wrapping for multi-line content alignment
  • Overuse space-between when only one track exists

Key Takeaways

Knowledge Unlocked

Five things to remember about place-content

Use these points when aligning content tracks in grid and flex layouts.

5
Core concepts
02

normal Default

Longhand initial.

Default
03

center

Both axes.

Pattern
04

Two Values

Block then inline.

Syntax
pi 05

place-items

Different shorthand.

Related

❓ Frequently Asked Questions

place-content is a shorthand that sets align-content and justify-content together. It controls how content is aligned and distributed along the block and inline axes in a grid or flex container.
place-content aligns the overall content tracks within the container. place-items aligns individual items inside their cells. They solve different layout problems.
Yes. place-content works on flex containers with wrapped lines and on grid containers. It is most useful when extra space exists along an axis.
A single value applies to both align-content and justify-content. For example, place-content: center centers content on both axes.
The initial value follows align-content and justify-content, which is normal for both axes unless you set something else.

Practice in the Live Editor

Open the HTML editor, create a grid or flex container, and experiment with place-content values.

HTML Editor →

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.

5 people found this page helpful