How place-content Can Clean Up Your CSS
Writing CSS often involves repeating multiple alignment properties to position content correctly. If you’re using CSS Grid or a multi-line Flexbox layout, there’s a cleaner way to handle this.
The place-content property combines two commonly used alignment properties into a single declaration, making your CSS shorter, easier to read, and simpler to maintain.
In this guide, you’ll learn what place-content does, how it works, and when to use it.
What Is place-content?
place-content is a CSS shorthand property that combines:
- align-content
- justify-content
Instead of writing both properties separately, you can define them together with a single line.
Without place-content
| 1 2 3 4 5 6 7 8 9 | .container { display: grid; align-content: center; justify-content: space-between; } |
With place-content
| 1 2 3 4 5 6 7 | .container { display: grid; place-content: center space-between; } |
| 1 | place-content: <align-content> <justify-content>; |
Syntax
| 1 | place-content: <align-content> <justify-content>; |
| 1 | place-content: center; |
| 1 2 3 | align-content: center; justify-content: center; |
When Should You Use place-content?
place-content works best when you’re using:
- CSS Grid layouts
- Multi-line Flexbox layouts (flex-wrap: wrap)
It controls how the entire content is distributed inside the container when there is extra available space.
Example Using CSS Grid
| 1 2 3 4 5 6 7 8 9 10 11 12 | .container { display: grid; height: 400px; place-content: center; } |
Example with Different Values
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | .container { display: grid; place-content: start space-evenly; } This is equivalent to: align-content: start; justify-content: space-evenly; |
Using place-content with Flexbox
Although place-content is most commonly used with CSS Grid, it also works with Flexbox when multiple flex lines exist.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Example: .container { display: flex; flex-wrap: wrap; place-content: center space-between; } |
If the flex container contains only a single row, align-content has no effect, so place-content provides little benefit in that case.
Benefits of Using place-content
Using place-content offers several advantages:
- Reduces repetitive CSS
- Makes layout code easier to read
- Keeps related alignment properties together
- Improves maintainability
- Works naturally with modern CSS Grid layouts
When Not to Use It
Avoid using place-content if you only need to control one alignment property.
For example, if you only want to change horizontal alignment, using justify-content directly is clearer.
| 1 2 3 4 5 6 7 | .container { display: grid; justify-content: center; } |
Browser Support
place-content is supported by all modern browsers, including recent versions of:
- Chrome
- Firefox
- Edge
- Safari
If you need to support very old browsers, verify compatibility before using it in production.
Conclusion
The place-content property is a small CSS feature that can significantly improve the readability of your layout code. By combining align-content and justify-content into a single declaration, it reduces repetition while keeping alignment rules organized.
If you’re working with CSS Grid or multi-line Flexbox layouts, using place-content is a simple way to write cleaner, more maintainable CSS.
Recent help desk articles
Greetings! I'm Aneesh Sreedharan, CEO of 2Hats Logic Solutions. At 2Hats Logic Solutions, we are dedicated to providing technical expertise and resolving your concerns in the world of technology. Our blog page serves as a resource where we share insights and experiences, offering valuable perspectives on your queries.

